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,DebugResource,DirectoryResource,HelloWorldResource,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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiderror()[* /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, setContextMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPatch, doPost, doPut, doTrace, getLastModified, isSensitiveHeader, serviceMethods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
BasicRestServlet
public BasicRestServlet()
-
-
Method Details
-
error
Description copied from interface:BasicRestOperations[* /error] - Error occurred.- Specified by:
errorin interfaceBasicRestOperations
-
getFavIcon
Description copied from interface:BasicRestOperations[GET favicon.ico] - Retrieve favorites icon image.- Specified by:
getFavIconin interfaceBasicRestOperations- Returns:
- A bean containing the contents for the OPTIONS page.
-
getHtdoc
Description copied from interface:BasicRestOperations[GET /htdocs/*] - Retrieve static file.- Specified by:
getHtdocin interfaceBasicRestOperations- Parameters:
path- The path to retrieve.locale- The locale of the HTTP request.- Returns:
- An HTTP resource representing the static file.
- Throws:
NotFound
-
getStats
Description copied from interface:BasicRestOperations[GET /stats] - Timing statistics.Timing statistics for method invocations on this resource.
- Specified by:
getStatsin interfaceBasicRestOperations- Parameters:
req- The HTTP request.- Returns:
- A collection of timing statistics for each annotated method on this resource.
-
getSwagger
Description copied from interface:BasicRestOperations[GET /api] - Show resource options.- Specified by:
getSwaggerin interfaceBasicRestOperations- Parameters:
req- The HTTP request.- Returns:
- A bean containing the contents for the OPTIONS page.
-