blob: ddf24771e7a9a7175efd226ead978e1604acb2c4 [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.
***************************************************************************************************************************/
-->
Class Hierarchy
<p>
The class hierarchy for the REST servlet class is shown below:
</p>
<ul class='javatree'>
<li class='jac'>
{@link javax.servlet.http.HttpServlet javax.servlet.http.HttpServlet}
<ul>
<li class='jac'>
{@link oajr.RestServlet org.apache.juneau.rest.RestServlet}
<br>Contains all the main logic.
<ul>
<li class='jac'>{@link oajr.BasicRestServlet org.apache.juneau.rest.BasicRestServlet}
<br>Provides a default set of serializers, parsers, options page, stylesheet, and other common settings.
<ul>
<li class='jac'>{@link oajr.BasicRestServletGroup org.apache.juneau.rest.BasicRestServletGroup}
<br>A default implementation for "router" pages.
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>
For top-level resources, you'll typically extend from one of the classes above.
</p>
<p>
For child resources, you can either extend from one of the classes above, or extend from one of the following
that provides identical support but does not extent from <c>HttpServlet</c>:
</p>
<ul class='javatree'>
<li class='jic'>
{@link oajr.BasicRestConfig}
<ul>
<li class='jac'>{@link oajr.BasicRest org.apache.juneau.rest.BasicRest}
<br>Provides a default set of serializers, parsers, options page, stylesheet, and other common settings.
<ul>
<li class='jac'>{@link oajr.BasicRestGroup org.apache.juneau.rest.BasicRestGroup}
<br>A default implementation for "router" pages.
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>
One reason to use the latter classes as your base classes is when you're implementing REST resources as
<ja>@Bean</ja>-annotated Spring Beans and you don't want them to be automatically registered as top-level servlets.
</p>
<p>
The servlets with RDF support require Jena on the classpath.
All other serializers and parsers do not have any external library dependencies.
For this reason, we have separate servlets for supporting RDF so that you don't need Jena if you don't need to
support RDF.
</p>
<p>
Everything is configured through the following classes which you will see a lot:
</p>
<ul class='javatree'>
<li class='jc'>{@link oajr.RestContext} - Each resource class instance has one copy that holds all of its configuration.
<li class='jc'>{@link oajr.RestContextBuilder} - Builder for the class above.
</ul>