Package org.apache.juneau.rest.servlet
Class RestObject
java.lang.Object
org.apache.juneau.rest.servlet.RestObject
- Direct Known Subclasses:
BasicRestObject
Identical to
RestServlet
but doesn't extend from HttpServlet
.
This is particularly useful in Spring Boot environments that auto-detect servlets to deploy in servlet containers, but you want this resource to be deployed as a child instead.
See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Main logger method.protected RestContext
Returns the read-only context object that contains all the configuration information about this resource.Returns the current thread-local HTTP request.Returns the current thread-local HTTP response.void
Log a message.void
Log a message.protected void
setContext
(RestContext context) Sets the context object for this servlet.
-
Constructor Details
-
RestObject
public RestObject()
-
-
Method Details
-
setContext
Sets the context object for this servlet.- Parameters:
context
- Sets the context object on this servlet.- Throws:
jakarta.servlet.ServletException
- If error occurred during post-initialiation.
-
getContext
Returns the read-only context object that contains all the configuration information about this resource.- Returns:
- The context information on this servlet.
-
log
Log a message.Subclasses can intercept the handling of these messages by overriding
doLog(Level, Throwable, Supplier)
.- Parameters:
level
- The log level.msg
- The message to log.args
- OptionalMessageFormat
-style arguments.
-
log
Log a message.Subclasses can intercept the handling of these messages by overriding
doLog(Level, Throwable, Supplier)
.- Parameters:
level
- The log level.cause
- The cause.msg
- The message to log.args
- OptionalMessageFormat
-style arguments.
-
doLog
Main logger method.The default behavior logs a message to the Java logger of the class name.
Subclasses can override this method to implement their own logger handling.
- Parameters:
level
- The log level.cause
- Optional throwable.msg
- The message to log.
-
getRequest
Returns the current thread-local HTTP request.- Returns:
- The current thread-local HTTP request, or
null if it wasn't created.
-
getResponse
Returns the current thread-local HTTP response.- Returns:
- The current thread-local HTTP response, or
null if it wasn't created.
-