blob: b0dc46ebe9f4f48fe9ea8c674c4c0c3eddb19c42 [file] [log] [blame]
<!--
/***************************************************************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
***************************************************************************************************************************/
-->
HtmlDocSerializer
<p>
{@link oaj.html.HtmlDocSerializer} is an extension of {@link oaj.html.HtmlSerializer}
that wraps serialized POJOs in a complete HTML document.
</p>
<ul class='javatree'>
<li class='jc'>{@link oaj.html.HtmlDocSerializer}
<ul>
<li class='jf'>{@link oaj.html.HtmlDocSerializer#HTMLDOC_aside HTMLDOC_aside}
<li class='jf'>{@link oaj.html.HtmlDocSerializer#HTMLDOC_footer HTMLDOC_footer}
<li class='jf'>{@link oaj.html.HtmlDocSerializer#HTMLDOC_head HTMLDOC_head}
<li class='jf'>{@link oaj.html.HtmlDocSerializer#HTMLDOC_header HTMLDOC_header}
<li class='jf'>{@link oaj.html.HtmlDocSerializer#HTMLDOC_nav HTMLDOC_nav}
<li class='jf'>{@link oaj.html.HtmlDocSerializer#HTMLDOC_navlinks HTMLDOC_navlinks}
<li class='jf'>{@link oaj.html.HtmlDocSerializer#HTMLDOC_noResultsMessage HTMLDOC_noResultsMessage}
<li class='jf'>{@link oaj.html.HtmlDocSerializer#HTMLDOC_nowrap HTMLDOC_nowrap}
<li class='jf'>{@link oaj.html.HtmlDocSerializer#HTMLDOC_script HTMLDOC_script}
<li class='jf'>{@link oaj.html.HtmlDocSerializer#HTMLDOC_style HTMLDOC_style}
<li class='jf'>{@link oaj.html.HtmlDocSerializer#HTMLDOC_stylesheet HTMLDOC_stylesheet}
<li class='jf'>{@link oaj.html.HtmlDocSerializer#HTMLDOC_template HTMLDOC_template}
</ul>
</ul>
<p>
This class is used extensively in the creation of POJO-based user interfaces in the REST API.
</p>
<h5 class='figure'>Example:</h5>
<p class='bpcode w800'>
<jd>/**
* Sample REST resource that prints out a simple "Hello world!" message.
*/</jd>
<ja>@Rest</ja>(
path=<js>"/helloWorld"</js>,
htmldoc=<ja>@HtmlDoc</ja>(
navlinks={
<js>"up: request:/.."</js>,
<js>"options: servlet:/?method=OPTIONS"</js>
},
aside={
<js>"&lt;div style='max-width:400px' class='text'&gt;"</js>,
<js>" &lt;p&gt;This page shows a resource that simply response with a 'Hello world!' message&lt;/p&gt;"</js>,
<js>" &lt;p&gt;The POJO serialized is a simple String.&lt;/p&gt;"</js>,
<js>"&lt;/div&gt;"</js>
}
)
)
<jk>public class</jk> HelloWorldResource <jk>extends</jk> BasicRestServlet {...}
</p>
<p>
The {@link oaj.html.HtmlDocSerializer#HTMLDOC_template HTMLDOC_template} setting defines
a template for the HTML page being generated.
The default template is described next.
</p>