HtmlDocSerializer
HtmlDocSerializer is an extension of HtmlSerializer that wraps serialized POJOs in a complete HTML document.
The class hierarchy for the builder of this serializer is:
Refer to the builder javadocs for configurable settings.
This class is used extensively in the creation of POJO-based user interfaces in the REST API.
Example
/**
* Sample REST resource that prints out a simple "Hello world!" message.
*/
@Rest(path="/helloWorld")
@HtmlDocConfig(
navlinks={
"up: request:/..",
"options: servlet:/?method=OPTIONS"
},
aside={
"",
" <p>This page shows a resource that simply response with a 'Hello world!' message</p>",
" <p>The POJO serialized is a simple String.</p>",
""
}
)
public class HelloWorldResource extends BasicRestServlet {
// ...
}
The HtmlDocSerializer.Builder.template(Class) setting defines a template for the HTML page being generated. The default template is described next.