Skip to content

Structure of the HAL view

C.A.B edited this page Nov 30, 2017 · 5 revisions

Just like regular GSON view the HAL view includes the model and the definition of the resulting document. The model is exactly the same as in regular GSON view.

The definition of the HAL document start with keyword "hal" follow by some optional parameters and closure.

Parameters for the top level "hal" element

The top level "hal" element may have no parameters, single URL parameter, single values parameter, URL and values parameters or all 3 as listed below.

parameter default value description
URL URL from the request Can be any value described in URL page including empty string
queryParams -- The query part of the URL
values -- The values to include into the resulting document on the top level

The values of URL and queryParams define the self href of the top level _links. The body of the resulting JSON will include content of parameter values, which should be a Map<String, Object>.

Closure for the top level "hal" element

The closure may include any combination of follow:

Each element includes the name. All elements of the same kind with the same name are combined into collection of that type with that name.

Clone this wiki locally