public class HtmlDocSerializer extends HtmlStrippedDocSerializer
Accept
types: text/html
Produces Content-Type
types: text/html
HtmlSerializer
, except wraps the response in <html>
,
<head>
, and <body>
tags so that it can be rendered in a browser.
Configurable properties are typically specified via RestResponse.setProperty()
method.
Note that shortcut annotations are also provided for these particular settings:
The $L{...}
variable represent localized strings pulled from the resource bundle identified by the
messages
annotation.
These variables are replaced at runtime based on the HTTP request locale.
Several built-in runtime variable types are defined, and the API can be extended to include user-defined variables.
HtmlSerializer.Sq, HtmlSerializer.SqReadable
XmlSerializer.Ns, XmlSerializer.NsSq, XmlSerializer.NsSqReadable
Modifier and Type | Field and Description |
---|---|
static HtmlDocSerializer |
DEFAULT
Default serializer, all default settings.
|
static String |
HTMLDOC_aside
Configuration property: Aside section contents.
|
static String |
HTMLDOC_footer
Configuration property: Footer section contents.
|
static String |
HTMLDOC_head
Configuration property: Additional head section content.
|
static String |
HTMLDOC_header
Configuration property: Header section contents.
|
static String |
HTMLDOC_nav
Configuration property: Nav section contents.
|
static String |
HTMLDOC_navlinks
Configuration property: Page navigation links.
|
static String |
HTMLDOC_navlinks_add
Configuration property: Add to the
HTMLDOC_navlinks property. |
static String |
HTMLDOC_noResultsMessage
Configuration property: No-results message.
|
static String |
HTMLDOC_nowrap
Configuration property: Prevent word wrap on page.
|
static String |
HTMLDOC_script
Configuration property: Javascript code.
|
static String |
HTMLDOC_script_add
Configuration property: Add to the
HTMLDOC_script property. |
static String |
HTMLDOC_style
Configuration property: CSS style code.
|
static String |
HTMLDOC_style_add
Configuration property: Add to the
HTMLDOC_style property. |
static String |
HTMLDOC_stylesheet
Configuration property: Stylesheet import URLs.
|
static String |
HTMLDOC_stylesheet_add
Configuration property: Add to the
HTMLDOC_stylesheet property. |
static String |
HTMLDOC_template
Configuration property: HTML document template.
|
DEFAULT_SQ, DEFAULT_SQ_READABLE, HTML_addBeanTypeProperties, HTML_addKeyValueTableHeaders, HTML_detectLabelParameters, HTML_detectLinksInStrings, HTML_labelParameter, HTML_uriAnchorText
DEFAULT_NS, DEFAULT_NS_SQ, DEFAULT_NS_SQ_READABLE, XML_addBeanTypeProperties, XML_addNamespaceUrisToRoot, XML_autoDetectNamespaces, XML_defaultNamespace, XML_enableNamespaces, XML_namespaces, XML_xsNamespace
SERIALIZER_abridged, SERIALIZER_addBeanTypeProperties, SERIALIZER_detectRecursions, SERIALIZER_ignoreRecursions, SERIALIZER_initialDepth, SERIALIZER_listener, SERIALIZER_maxDepth, SERIALIZER_maxIndent, SERIALIZER_quoteChar, SERIALIZER_sortCollections, SERIALIZER_sortMaps, SERIALIZER_trimEmptyCollections, SERIALIZER_trimEmptyMaps, SERIALIZER_trimNullProperties, SERIALIZER_trimStrings, SERIALIZER_uriContext, SERIALIZER_uriRelativity, SERIALIZER_uriResolution, SERIALIZER_useWhitespace
BEAN_beanClassVisibility, BEAN_beanConstructorVisibility, BEAN_beanDictionary, BEAN_beanDictionary_add, BEAN_beanDictionary_remove, BEAN_beanFieldVisibility, BEAN_beanFilters, BEAN_beanFilters_add, BEAN_beanFilters_remove, BEAN_beanMapPutReturnsOldValue, BEAN_beanMethodVisibility, BEAN_beansRequireDefaultConstructor, BEAN_beansRequireSerializable, BEAN_beansRequireSettersForGetters, BEAN_beansRequireSomeProperties, BEAN_beanTypePropertyName, BEAN_debug, BEAN_excludeProperties, BEAN_ignoreInvocationExceptionsOnGetters, BEAN_ignoreInvocationExceptionsOnSetters, BEAN_ignorePropertiesWithoutSetters, BEAN_ignoreUnknownBeanProperties, BEAN_ignoreUnknownNullBeanProperties, BEAN_implClasses, BEAN_includeProperties, BEAN_locale, BEAN_mediaType, BEAN_notBeanClasses, BEAN_notBeanClasses_add, BEAN_notBeanClasses_remove, BEAN_notBeanPackages, BEAN_notBeanPackages_add, BEAN_notBeanPackages_remove, BEAN_pojoSwaps, BEAN_pojoSwaps_add, BEAN_pojoSwaps_remove, BEAN_propertyNamer, BEAN_sortProperties, BEAN_timeZone, BEAN_useInterfaceProxies, BEAN_useJavaBeanIntrospector, DEFAULT_SORTED
Constructor and Description |
---|
HtmlDocSerializer(PropertyStore ps)
Constructor.
|
HtmlDocSerializer(PropertyStore ps,
String produces,
String... accept)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
ObjectMap |
asMap()
Returns the properties defined on this bean context as a simple map for debugging purposes.
|
HtmlDocSerializerSession |
createSession(SerializerSessionArgs args)
Create the session object used for actual serialization of objects.
|
builder, create, getSchemaSerializer
isWriterSerializer, println, serialize, toString, toStringObject
createDefaultSessionArgs, createSession, getMediaTypes, getResponseContentType, serialize
_class, createBeanSession, createBeanSession, createDefaultBeanSessionArgs, createSession, createSession, dumpCacheStats, getBeanMeta, getBeanRegistry, getBeanTypePropertyName, getClassMeta, getClassMeta, getClassMetaForObject, getExcludeProperties, getImplClassConstructor, getIncludeProperties, hasSameCache, isBean, isNotABean, newInstance, newInstance, newInstanceFromOuter, object, resolveClassMeta, string
equals, getArrayProperty, getArrayProperty, getBooleanProperty, getClassArrayProperty, getClassArrayProperty, getClassArrayProperty, getClassListProperty, getClassListProperty, getClassMapProperty, getClassMapProperty, getClassProperty, getClassSetProperty, getClassSetProperty, getInstanceArrayProperty, getInstanceArrayProperty, getInstanceArrayProperty, getInstanceProperty, getInstanceProperty, getInstanceProperty, getIntegerProperty, getListProperty, getListProperty, getLongProperty, getMapProperty, getProperty, getProperty, getPropertyKeys, getPropertyStore, getSetProperty, getSetProperty, getStringProperty, hashCode, toString
public static final String HTMLDOC_aside
List<String>
Allows you to specify the contents of the aside section on the HTML page. The aside section floats on the right of the page for providing content supporting the serialized content of the page.
By default, the aside section is empty.
public static final String HTMLDOC_footer
List<String>
Allows you to specify the contents of the footer section on the HTML page.
By default, the footer section is empty.
public static final String HTMLDOC_head
List<String>
Adds the specified HTML content to the head section of the page.
A shortcut on
public static final String HTMLDOC_header
List<String>
Allows you to override the contents of the header section on the HTML page. The header section normally contains the title and description at the top of the page.
public static final String HTMLDOC_nav
List<String>
Allows you to override the contents of the nav section on the HTML page. The nav section normally contains the page links at the top of the page.
When this property is specified, the HTMLDOC_navlinks
property is ignored.
public static final String HTMLDOC_navlinks
List<String>
Adds a list of hyperlinks immediately under the title and description but above the content of the page.
This can be used to provide convenient hyperlinks when viewing the REST interface from a browser.
The value is an array of strings with two possible values:
Relative URLs are considered relative to the servlet path.
For example, if the servlet path is UriResolver
such as
The AddressBookResource
sample class uses this property...
...to produce this list of links on the HTML page...
A shortcut on
public static final String HTMLDOC_navlinks_add
HTMLDOC_navlinks
property.public static final String HTMLDOC_noResultsMessage
String
Allows you to specify the string message used when trying to serialize an empty array or empty list.
A value of
public static final String HTMLDOC_nowrap
Boolean
Adds
public static final String HTMLDOC_script
List<String>
Adds the specified Javascript code to the HTML page.
A shortcut on
public static final String HTMLDOC_script_add
HTMLDOC_script
property.public static final String HTMLDOC_style
List<String>
Adds the specified CSS instructions to the HTML page.
A shortcut on
public static final String HTMLDOC_style_add
HTMLDOC_style
property.public static final String HTMLDOC_stylesheet
List<String>
Adds a link to the specified stylesheet URL.
Note that this stylesheet is controlled by the
annotation.
public static final String HTMLDOC_stylesheet_add
HTMLDOC_stylesheet
property.public static final String HTMLDOC_template
Class<? extends HtmlDocTemplate>
HtmlDocTemplateBasic.class
Specifies the template to use for serializing the page.
By default, the HtmlDocTemplateBasic
class is used to construct the contents of the HTML page, but
can be overridden with your own custom implementation class.
public static final HtmlDocSerializer DEFAULT
public HtmlDocSerializer(PropertyStore ps)
ps
- The property store containing all the settings for this object.public HtmlDocSerializer(PropertyStore ps, String produces, String... accept)
ps
- The property store containing all the settings for this object.produces
- The media type that this serializer produces.accept
- The accept media types that the serializer can handle.
Can contain meta-characters per the media-type
specification of
RFC2616/14.1
If empty, then assumes the only media type supported is produces
.
For example, if this serializer produces
public HtmlDocSerializerSession createSession(SerializerSessionArgs args)
Serializer
createSession
in class HtmlStrippedDocSerializer
args
- Runtime arguments.
These specify session-level information such as locale and URI context.
It also include session-level properties that override the properties defined on the bean and serializer
contexts.public ObjectMap asMap()
Context
asMap
in class HtmlSerializer
Copyright © 2018 Apache. All rights reserved.