Package org.apache.juneau.bean.hal


package org.apache.juneau.bean.hal
Juneau @Marshalled types for the HAL (Hypertext Application Language) hypermedia format, also covered by draft-kelly-json-hal-08.
Overview

HAL is a JSON-based hypermedia format used by RESTful APIs to express links and embedded resources alongside the payload itself. This module provides typed Juneau beans modeling the HAL wire format — no marshaller is needed; the existing JsonSerializer / JsonParser already produce and consume application/hal+json. The matching ContentType constant is org.apache.juneau.http.header.ContentType#APPLICATION_HAL_JSON (in juneau-rest-common).

Bean Classes
Example

// Build a HAL resource with a self link, a curies array, and embedded items. HalResource order = new HalResource() .addLink("self", new HalLink().setHref("/orders/123")) .addLinks("curies", new HalLink().setName("acme").setHref("https://acme.example/{rel}").setTemplated(true)) .set("total", 99.50); String json = JsonSerializer.DEFAULT.write(order); HalResource back = JsonParser.DEFAULT.read(json, HalResource.class);

See Also: