Save This Page
Home » spring-framework-2.5.4 » org.springframework » web » servlet » handler » [javadoc | source]
org.springframework.web.servlet.handler
abstract public class: AbstractHandlerMapping [javadoc | source]
java.lang.Object
   org.springframework.context.support.ApplicationObjectSupport
      org.springframework.web.context.support.WebApplicationObjectSupport
         org.springframework.web.servlet.handler.AbstractHandlerMapping

All Implemented Interfaces:
    HandlerMapping, Ordered, ServletContextAware, ApplicationContextAware

Direct Known Subclasses:
    DefaultAnnotationHandlerMapping, AbstractPathMapHandlerMapping, ControllerBeanNameHandlerMapping, CommonsPathMapHandlerMapping, BeanNameUrlHandlerMapping, AbstractUrlHandlerMapping, SimpleUrlHandlerMapping, AbstractControllerUrlHandlerMapping, ControllerClassNameHandlerMapping, AbstractDetectingUrlHandlerMapping

Abstract base class for org.springframework.web.servlet.HandlerMapping implementations. Supports ordering, a default handler, and handler interceptors.

Note: This base class does not support exposure of the #PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE . Support for this attribute is up to concrete subclasses, typically based on request URL mappings.

Fields inherited from org.springframework.context.support.ApplicationObjectSupport:
logger
Method from org.springframework.web.servlet.handler.AbstractHandlerMapping Summary:
adaptInterceptor,   extendInterceptors,   getAdaptedInterceptors,   getDefaultHandler,   getHandler,   getHandlerExecutionChain,   getHandlerInternal,   getOrder,   initApplicationContext,   initInterceptors,   setDefaultHandler,   setInterceptors,   setOrder
Methods from org.springframework.web.context.support.WebApplicationObjectSupport:
getServletContext,   getTempDir,   getWebApplicationContext,   initApplicationContext,   initServletContext,   isContextRequired,   setServletContext
Methods from org.springframework.context.support.ApplicationObjectSupport:
getApplicationContext,   getMessageSourceAccessor,   initApplicationContext,   initApplicationContext,   isContextRequired,   requiredContextClass,   setApplicationContext
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.springframework.web.servlet.handler.AbstractHandlerMapping Detail:
 protected HandlerInterceptor adaptInterceptor(Object interceptor) 
    Adapt the given interceptor object to the HandlerInterceptor interface.

    Supported interceptor types are HandlerInterceptor and WebRequestInterceptor. Each given WebRequestInterceptor will be wrapped in a WebRequestHandlerInterceptorAdapter. Can be overridden in subclasses.

 protected  void extendInterceptors(List interceptors) 
    Extension hook that subclasses can override to register additional interceptors, given the configured interceptors (see #setInterceptors ).

    Will be invoked before #initInterceptors() adapts the specified interceptors into HandlerInterceptor instances.

    The default implementation is empty.

 protected final HandlerInterceptor[] getAdaptedInterceptors() 
    Return the adapted interceptors as HandlerInterceptor array.
 public Object getDefaultHandler() 
    Return the default handler for this handler mapping, or null if none.
 public final HandlerExecutionChain getHandler(HttpServletRequest request) throws Exception 
    Look up a handler for the given request, falling back to the default handler if no specific one is found.
 protected HandlerExecutionChain getHandlerExecutionChain(Object handler,
    HttpServletRequest request) 
    Build a HandlerExecutionChain for the given handler, including applicable interceptors.

    The default implementation simply builds a standard HandlerExecutionChain with the given handler and this handler mapping's common interceptors. Subclasses may override this in order to extend/rearrange the list of interceptors.

    NOTE: The passed-in handler object may be a raw handler or a pre-built HandlerExecutionChain. This method should handle those two cases explicitly, either building a new HandlerExecutionChain or extending the existing chain.

    For simply adding an interceptor, consider calling super.getHandlerExecutionChain and invoking HandlerExecutionChain#addInterceptor on the returned chain object.

 abstract protected Object getHandlerInternal(HttpServletRequest request) throws Exception
    Look up a handler for the given request, returning null if no specific one is found. This method is called by #getHandler ; a null return value will lead to the default handler, if one is set.

    Note: This method may also return a pre-built HandlerExecutionChain , combining a handler object with dynamically determined interceptors. Statically specified interceptors will get merged into such an existing chain.

 public final int getOrder() 
 protected  void initApplicationContext() throws BeansException 
    Initializes the interceptors.
 protected  void initInterceptors() 
    Initialize the specified interceptors, adapting them where necessary.
 public  void setDefaultHandler(Object defaultHandler) 
    Set the default handler for this handler mapping. This handler will be returned if no specific mapping was found.

    Default is null, indicating no default handler.

 public  void setInterceptors(Object[] interceptors) 
    Set the interceptors to apply for all handlers mapped by this handler mapping.

    Supported interceptor types are HandlerInterceptor and WebRequestInterceptor.

 public final  void setOrder(int order) 
    Specify the order value for this HandlerMapping bean.

    Default value is Integer.MAX_VALUE, meaning that it's non-ordered.