service method to handle a request.
Last-modified checking is not explicitly supported: This is typically handled by the Servlet implementation itself (usually deriving from the HttpServlet base class).
This adapter is not activated by default; it needs to be defined as a bean in the DispatcherServlet context. It will automatically apply to mapped handler beans that implement the Servlet interface then.
Note that Servlet instances defined as bean will not receive initialization and destruction callbacks, unless a special post-processor such as SimpleServletPostProcessor is defined in the DispatcherServlet context.
Alternatively, consider wrapping a Servlet with Spring's ServletWrappingController. This is particularly appropriate for existing Servlet classes, allowing to specify Servlet initialization parameters etc.
jakarta.servlet.Servlet , jakarta.servlet.http.HttpServlet , SimpleServletPostProcessor, org.springframework.web.servlet.mvc.ServletWrappingController
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public long | getLastModified(HttpServletRequest
current HTTP request request, Object the handler to use handler)Implements org. Same contract as for HttpServlet's |
| public ModelAndView | handle(HttpServletRequest
current HTTP request request, HttpServletResponse current HTTP response response, Object the handler to use. This object must have previously been passed
to the handler)supports method of this interface, which must have
returned true.Implements org. Use the given handler to handle this request. |
| public boolean | supports(Object
the handler object to check handler)Implements org. Given a handler instance, return whether this |
| SimpleServletHandlerAdapter | back to summary |
|---|---|
| public SimpleServletHandlerAdapter() | |
| getLastModified | back to summary |
|---|---|
| public long getLastModified(HttpServletRequest request, Object handler) Implements org. Doc from org. Same contract as for HttpServlet's
| |
| handle | back to summary |
|---|---|
| public ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception Implements org. Doc from org. Use the given handler to handle this request. The workflow that is required may vary widely.
| |
| supports | back to summary |
|---|---|
| public boolean supports(Object handler) Implements org. Doc from org. Given a handler instance, return whether this A typical implementation:
| |