public @interface HtmlDoc
HtmlDocSerializer
.
Used with @RestResource.htmldoc()
and @RestMethod.htmldoc()
to customize the HTML view of serialized POJOs.
All annotations specified here have no effect on any serializers other than HtmlDocSerializer
and is
provided as a shorthand method of for specifying configuration properties.
For example, the following two methods for defining the HTML nav links are considered equivalent:
The purpose of these annotation is to populate the HTML document view which by default consists of the following structure:
Modifier and Type | Optional Element and Description |
---|---|
String[] |
aside
Sets the HTML aside section contents.
|
String[] |
footer
Sets the HTML footer section contents.
|
String[] |
head
Adds arbitrary content to the HTML
|
String[] |
header
Sets the HTML header section contents.
|
String[] |
nav
Sets the HTML nav section contents.
|
String[] |
navlinks
Sets the links in the HTML nav section.
|
String |
noResultsMessage
Specifies the text to display when serializing an empty array or collection.
|
boolean |
nowrap
Shorthand method for forcing the rendered HTML content to be no-wrap.
|
String[] |
script
Sets the HTML script section contents.
|
String[] |
style
Sets the HTML CSS style section contents.
|
String[] |
stylesheet
Sets the CSS URL in the HTML CSS style section.
|
Class<? extends HtmlDocTemplate> |
template
Specifies the template class to use for rendering the HTML page.
|
Class<? extends Widget>[] |
widgets
Configuration property: HTML Widgets.
|
public abstract String[] aside
The aside section typically floats on the right side of the page.
public abstract String[] footer
The footer section typically floats on the bottom of the page.
public abstract String[] head
public abstract String[] header
The page header normally contains the title and description, but this value can be used to override the contents to be whatever you want.
public abstract String[] nav
The nav section of the page contains the links.
navlinks()
value will be ignored.
public abstract String[] navlinks
The page links are positioned immediately under the title and text.
The value is an array of strings with two possible values:
public abstract String noResultsMessage
public abstract boolean nowrap
This only applies to the rendered data portion of the page.
public abstract String[] script
public abstract String[] style
public abstract String[] stylesheet
Specifies the URL to the stylesheet to add as a link in the style tag in the header.
public abstract Class<? extends HtmlDocTemplate> template
By default, uses HtmlDocTemplateBasic
to render the contents, although you can provide your own custom
renderer or subclasses from the basic class to have full control over how the page is rendered.
public abstract Class<? extends Widget>[] widgets
Defines widgets that can be used in conjunction with string variables of the form
Widgets resolve the following variables:
Widget.getHtml(RestRequest)
.
Widget.getScript(RestRequest)
.
Widget.getStyle(RestRequest)
.
The following examples shows how to associate a widget with a REST method and then have it rendered in the links and aside section of the page:
Copyright © 2018 Apache. All rights reserved.