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

Package org.springframework.web.servlet.handler

Types

AbstractDetectingUrlHandlerMapping

abstract class AbstractDetectingUrlHandlerMapping : AbstractUrlHandlerMapping

Abstract implementation of the org.springframework.web.servlet.HandlerMapping interface, detecting URL mappings for handler beans through introspection of all defined beans in the application context.

AbstractHandlerMethodExceptionResolver

abstract class AbstractHandlerMethodExceptionResolver : AbstractHandlerExceptionResolver

Abstract base class for org.springframework.web.servlet.HandlerExceptionResolver implementations that support handling exceptions from handlers of type HandlerMethod.

ConversionServiceExposingInterceptor

open class ConversionServiceExposingInterceptor : HandlerInterceptorAdapter

Interceptor that places the configured ConversionService in request scope so it's available during request processing. The request attribute name is "org.springframework.core.convert.ConversionService", the value of ConversionService.class.getName().

Mainly for use within JSP tags such as the spring:eval tag.

DispatcherServletWebRequest

open class DispatcherServletWebRequest : ServletWebRequest

ServletWebRequest subclass that is aware of org.springframework.web.servlet.DispatcherServlet's request context, such as the Locale determined by the configured org.springframework.web.servlet.LocaleResolver.

HandlerExceptionResolverComposite

open class HandlerExceptionResolverComposite : HandlerExceptionResolver, Ordered

A HandlerExceptionResolver that delegates to a list of other HandlerExceptionResolvers.

SimpleMappingExceptionResolver

open class SimpleMappingExceptionResolver : AbstractHandlerExceptionResolver

org.springframework.web.servlet.HandlerExceptionResolver implementation that allows for mapping exception class names to view names, either for a set of given handlers or for all handlers in the DispatcherServlet.

Error views are analogous to error page JSPs, but can be used with any kind of exception including any checked one, with fine-granular mappings for specific handlers.

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.

SimpleServletPostProcessor

open class SimpleServletPostProcessor : DestructionAwareBeanPostProcessor, ServletContextAware, ServletConfigAware

org.springframework.beans.factory.config.BeanPostProcessor that applies initialization and destruction callbacks to beans that implement the javax.servlet.Servlet interface.

After initialization of the bean instance, the Servlet init method will be called with a ServletConfig that contains the bean name of the Servlet and the ServletContext that it is running in.

Before destruction of the bean instance, the Servlet destroy will be called.

Note that this post-processor does not support Servlet initialization parameters. Bean instances that implement the Servlet interface are supposed to be configured like any other Spring bean, that is, through constructor arguments or bean properties.

For reuse of a Servlet implementation in a plain Servlet container and as a bean in a Spring context, consider deriving from Spring's org.springframework.web.servlet.HttpServletBean base class that applies Servlet initialization parameters as bean properties, supporting both the standard Servlet and the Spring bean initialization style.

Alternatively, consider wrapping a Servlet with Spring's org.springframework.web.servlet.mvc.ServletWrappingController. This is particularly appropriate for existing Servlet classes, allowing to specify Servlet initialization parameters etc.

SimpleUrlHandlerMapping

open class SimpleUrlHandlerMapping : AbstractUrlHandlerMapping

Implementation of the org.springframework.web.servlet.HandlerMapping interface to map from URLs to request handler beans. Supports both mapping to bean instances and mapping to bean names; the latter is required for non-singleton handlers.

The "urlMap" property is suitable for populating the handler map with bean references, e.g. via the map element in XML bean definitions.

Mappings to bean names can be set via the "mappings" property, in a form accepted by the java.util.Properties class, like as follows: /welcome.html=ticketController /show.html=ticketController The syntax is PATH=HANDLER_BEAN_NAME. If the path doesn't begin with a slash, one is prepended.

Supports direct matches (given "/test" -> registered "/test") and "*" pattern matches (given "/test" -> registered "/t*"). Note that the default is to map within the current servlet mapping if applicable; see the "alwaysUseFullPath" property. For details on the pattern options, see the org.springframework.util.AntPathMatcher javadoc.

UserRoleAuthorizationInterceptor

open class UserRoleAuthorizationInterceptor : HandlerInterceptorAdapter

Interceptor that checks the authorization of the current user via the user's roles, as evaluated by HttpServletRequest's isUserInRole method.

WebRequestHandlerInterceptorAdapter

open class WebRequestHandlerInterceptorAdapter : AsyncHandlerInterceptor

Adapter that implements the Servlet HandlerInterceptor interface and wraps an underlying WebRequestInterceptor.