Spring Framework

org.springframework.web.servlet.mvc.method
Class RequestMappingInfoHandlerMapping

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.web.context.support.WebApplicationObjectSupport
          extended by org.springframework.web.servlet.handler.AbstractHandlerMapping
              extended by org.springframework.web.servlet.handler.AbstractHandlerMethodMapping<RequestMappingInfo>
                  extended by org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping
All Implemented Interfaces:
Aware, InitializingBean, ApplicationContextAware, Ordered, ServletContextAware, HandlerMapping
Direct Known Subclasses:
RequestMappingHandlerMapping

public abstract class RequestMappingInfoHandlerMapping
extends AbstractHandlerMethodMapping<RequestMappingInfo>

Abstract base class for classes for which RequestMappingInfo defines the mapping between a request and a handler method.

Since:
3.1.0
Author:
Arjen Poutsma, Rossen Stoyanchev

Field Summary
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Fields inherited from interface org.springframework.web.servlet.HandlerMapping
BEST_MATCHING_PATTERN_ATTRIBUTE, INTROSPECT_TYPE_LEVEL_MAPPING, PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE, URI_TEMPLATE_VARIABLES_ATTRIBUTE
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
RequestMappingInfoHandlerMapping()
           
 
Method Summary
protected  java.util.Comparator<RequestMappingInfo> getMappingComparator(javax.servlet.http.HttpServletRequest request)
          Provide a Comparator to sort RequestMappingInfos matched to a request.
protected  java.util.Set<java.lang.String> getMappingPathPatterns(RequestMappingInfo info)
          Get the URL path patterns associated with this RequestMappingInfo.
protected  RequestMappingInfo getMatchingMapping(RequestMappingInfo info, javax.servlet.http.HttpServletRequest request)
          Check if the given RequestMappingInfo matches the current request and return a (potentially new) instance with conditions that match the current request -- for example with a subset of URL patterns.
protected  void handleMatch(RequestMappingInfo info, java.lang.String lookupPath, javax.servlet.http.HttpServletRequest request)
          Expose URI template variables and producible media types in the request.
protected  HandlerMethod handleNoMatch(java.util.Set<RequestMappingInfo> requestMappingInfos, java.lang.String lookupPath, javax.servlet.http.HttpServletRequest request)
          Iterate all RequestMappingInfos once again, look if any match by URL at least and raise exceptions accordingly.
 
Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMethodMapping
afterPropertiesSet, detectHandlerMethods, getHandlerInternal, getHandlerMethods, getMappingForMethod, handlerMethodsInitialized, initApplicationContext, initHandlerMethods, isHandler, lookupHandlerMethod, registerHandlerMethod, setDetectHandlerMethodsInAncestorContexts
 
Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping
adaptInterceptor, detectMappedInterceptors, extendInterceptors, getAdaptedInterceptors, getDefaultHandler, getHandler, getHandlerExecutionChain, getMappedInterceptors, getOrder, getPathMatcher, getUrlPathHelper, initInterceptors, setAlwaysUseFullPath, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setUrlDecode, setUrlPathHelper
 
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
 
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestMappingInfoHandlerMapping

public RequestMappingInfoHandlerMapping()
Method Detail

getMappingPathPatterns

protected java.util.Set<java.lang.String> getMappingPathPatterns(RequestMappingInfo info)
Get the URL path patterns associated with this RequestMappingInfo.

Specified by:
getMappingPathPatterns in class AbstractHandlerMethodMapping<RequestMappingInfo>

getMatchingMapping

protected RequestMappingInfo getMatchingMapping(RequestMappingInfo info,
                                                javax.servlet.http.HttpServletRequest request)
Check if the given RequestMappingInfo matches the current request and return a (potentially new) instance with conditions that match the current request -- for example with a subset of URL patterns.

Specified by:
getMatchingMapping in class AbstractHandlerMethodMapping<RequestMappingInfo>
Parameters:
info - the mapping to get a match for
request - the current HTTP servlet request
Returns:
an info in case of a match; or null otherwise.

getMappingComparator

protected java.util.Comparator<RequestMappingInfo> getMappingComparator(javax.servlet.http.HttpServletRequest request)
Provide a Comparator to sort RequestMappingInfos matched to a request.

Specified by:
getMappingComparator in class AbstractHandlerMethodMapping<RequestMappingInfo>
Parameters:
request - the current request
Returns:
the comparator, never null

handleMatch

protected void handleMatch(RequestMappingInfo info,
                           java.lang.String lookupPath,
                           javax.servlet.http.HttpServletRequest request)
Expose URI template variables and producible media types in the request.

Overrides:
handleMatch in class AbstractHandlerMethodMapping<RequestMappingInfo>
Parameters:
info - the matching mapping
lookupPath - mapping lookup path within the current servlet mapping
request - the current request
See Also:
HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, HandlerMapping.PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE

handleNoMatch

protected HandlerMethod handleNoMatch(java.util.Set<RequestMappingInfo> requestMappingInfos,
                                      java.lang.String lookupPath,
                                      javax.servlet.http.HttpServletRequest request)
                               throws javax.servlet.ServletException
Iterate all RequestMappingInfos once again, look if any match by URL at least and raise exceptions accordingly.

Overrides:
handleNoMatch in class AbstractHandlerMethodMapping<RequestMappingInfo>
Parameters:
requestMappingInfos - all registered mappings
lookupPath - mapping lookup path within the current servlet mapping
request - the current request
Throws:
HttpRequestMethodNotSupportedException - if there are matches by URL but not by HTTP method
HttpMediaTypeNotAcceptableException - if there are matches by URL but not by consumable media types
HttpMediaTypeNotAcceptableException - if there are matches by URL but not by producible media types
javax.servlet.ServletException - in case of errors

Spring Framework