Package org.apache.juneau.rest.servlet
Class BasicRestServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.apache.juneau.rest.servlet.RestServlet
org.apache.juneau.rest.servlet.BasicRestServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet
,jakarta.servlet.ServletConfig
,Serializable
,BasicUniversalConfig
,DefaultConfig
,DefaultHtmlConfig
,BasicRestOperations
- Direct Known Subclasses:
AtomFeedResource
,BasicRestServletGroup
,ConfigResource
,DirectoryResource
,JsonSchemaResource
,LogsResource
,PhotosResource
,RrpcServlet
,ShutdownResource
public abstract class BasicRestServlet
extends RestServlet
implements BasicRestOperations, BasicUniversalConfig
Subclass of
RestServlet
with default settings and standard methods defined.
Meant as a base class for top-level REST resources in servlet containers.
Provides support for JSON, XML, HTML, URL-Encoding, UON, XML, OpenAPI, and MessagePack. See BasicUniversalConfig
for details.
Implements the basic REST endpoints defined in BasicRestOperations
.
See Also:
-
Field Summary
Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
error()
[* /error] - Error occurred.[GET favicon.ico] - Retrieve favorites icon image.[GET /htdocs/*] - Retrieve static file.getStats
(RestRequest req) [GET /stats] - Timing statistics.getSwagger
(RestRequest req) [GET /api] - Show resource options.Methods inherited from class org.apache.juneau.rest.servlet.RestServlet
destroy, doLog, getContext, getPath, getRequest, getResponse, init, log, log, service, setContext
Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
Methods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
BasicRestServlet
public BasicRestServlet()
-
-
Method Details
-
getSwagger
Description copied from interface:BasicRestOperations
[GET /api] - Show resource options.- Specified by:
getSwagger
in interfaceBasicRestOperations
- Parameters:
req
- The HTTP request.- Returns:
- A bean containing the contents for the OPTIONS page.
-
getHtdoc
Description copied from interface:BasicRestOperations
[GET /htdocs/*] - Retrieve static file.- Specified by:
getHtdoc
in interfaceBasicRestOperations
- Parameters:
path
- The path to retrieve.locale
- The locale of the HTTP request.- Returns:
- An HTTP resource representing the static file.
- Throws:
NotFound
-
getFavIcon
Description copied from interface:BasicRestOperations
[GET favicon.ico] - Retrieve favorites icon image.- Specified by:
getFavIcon
in interfaceBasicRestOperations
- Returns:
- A bean containing the contents for the OPTIONS page.
-
error
Description copied from interface:BasicRestOperations
[* /error] - Error occurred.- Specified by:
error
in interfaceBasicRestOperations
-
getStats
Description copied from interface:BasicRestOperations
[GET /stats] - Timing statistics.Timing statistics for method invocations on this resource.
- Specified by:
getStats
in interfaceBasicRestOperations
- Parameters:
req
- The HTTP request.- Returns:
- A collection of timing statistics for each annotated method on this resource.
-