spring-framework / org.springframework.web.servlet.handler / SimpleServletHandlerAdapter

SimpleServletHandlerAdapter

open class SimpleServletHandlerAdapter : HandlerAdapter

Adapter to use the Servlet interface with the generic DispatcherServlet. Calls the Servlet's 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.

Author
Juergen Hoeller

Since
1.1.5

See Also
javax.servlet.Servletjavax.servlet.http.HttpServletSimpleServletPostProcessororg.springframework.web.servlet.mvc.ServletWrappingController

Constructors

<init>

SimpleServletHandlerAdapter()

Adapter to use the Servlet interface with the generic DispatcherServlet. Calls the Servlet's 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.

Functions

getLastModified

open fun getLastModified(request: HttpServletRequest, handler: Any): Long

handle

open fun handle(request: HttpServletRequest, response: HttpServletResponse, handler: Any): ModelAndView

supports

open fun supports(handler: Any): Boolean