Package org.springframework.web.servlet.mvc.method

# Class RequestMappingInfoHandlerMapping

java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.handler.AbstractHandlerMapping
org.springframework.web.servlet.handler.AbstractHandlerMethodMapping<RequestMappingInfo>
org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping

All Implemented Interfaces:
  `org.springframework.beans.factory.Aware`, `org.springframework.beans.factory.BeanNameAware`, `org.springframework.beans.factory.InitializingBean`, `org.springframework.context.ApplicationContextAware`, `org.springframework.core.Ordered`, `org.springframework.web.context.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
Author:
  Arjen Poutsma, Rossen Stoyanchev

## Field Summary

### Fields inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping

`mappingsLogger`

### Fields inherited from class org.springframework.context.support.ApplicationObjectSupport

`logger`

### Fields inherited from interface org.springframework.web.servlet.HandlerMapping

`BEST_MATCHING_HANDLER_ATTRIBUTE, BEST_MATCHING_PATTERN_ATTRIBUTE, INTROSPECT_TYPE_LEVEL_MAPPING, LOOKUP_PATH, MATRIX_VARIABLES_ATTRIBUTE, 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

Constructors
Modifier
Constructor
Description
`protected`
`RequestMappingInfoHandlerMapping()`

## Method Summary

Modifier and Type
Method
Description
`protected Set<String>`
`getDirectPaths(RequestMappingInfo info)`
Return the request mapping paths that are not patterns.
`protected org.springframework.web.method.HandlerMethod`
`getHandlerInternal(HttpServletRequest request)`
Look up a handler method for the given request.
`protected Comparator<RequestMappingInfo>`
`getMappingComparator(HttpServletRequest request)`
Provide a Comparator to sort RequestMappingInfos matched to a request.
`protected Set<String>`
`getMappingPathPatterns(RequestMappingInfo info)`
Get the URL path patterns associated with the supplied `RequestMappingInfo`.
`protected RequestMappingInfo`
`getMatchingMapping(RequestMappingInfo info, 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, String lookupPath, HttpServletRequest request)`
Expose URI template variables, matrix variables, and producible media types in the request.
`protected org.springframework.web.method.HandlerMethod`
`handleNoMatch(Set<RequestMappingInfo> infos, String lookupPath, HttpServletRequest request)`
Iterate all RequestMappingInfo's once again, look if any match by URL at least and raise exceptions according to what doesn't match.

### Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMethodMapping

`afterPropertiesSet, createHandlerMethod, detectHandlerMethods, getCandidateBeanNames, getCorsConfiguration, getHandlerMethods, getHandlerMethodsForMappingName, getMappingForMethod, getNamingStrategy, handlerMethodsInitialized, hasCorsConfigurationSource, initCorsConfiguration, initHandlerMethods, isHandler, lookupHandlerMethod, processCandidateBean, registerHandlerMethod, registerMapping, setDetectHandlerMethodsInAncestorContexts, setHandlerMethodMappingNamingStrategy, setPatternParser, unregisterMapping`

### Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping

`adaptInterceptor, detectMappedInterceptors, extendInterceptors, formatMappingName, getAdaptedInterceptors, getCorsConfigurationSource, getCorsHandlerExecutionChain, getCorsProcessor, getDefaultHandler, getHandler, getHandlerExecutionChain, getMappedInterceptors, getOrder, getPathMatcher, getPatternParser, getUrlPathHelper, initApplicationContext, initInterceptors, initLookupPath, setAlwaysUseFullPath, setBeanName, setCorsConfigurations, setCorsConfigurationSource, setCorsProcessor, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelper, usesPathPatterns`

### 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, obtainApplicationContext, requiredContextClass, setApplicationContext`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### RequestMappingInfoHandlerMapping

protected RequestMappingInfoHandlerMapping()

## Method Details

### getMappingPathPatterns

protected Set<String> getMappingPathPatterns(RequestMappingInfo info)
Get the URL path patterns associated with the supplied `RequestMappingInfo`.

Overrides:
  `getMappingPathPatterns` in class `AbstractHandlerMethodMapping<RequestMappingInfo>`

### getDirectPaths

protected Set<String> getDirectPaths(RequestMappingInfo info)
Description copied from class: `AbstractHandlerMethodMapping`
Return the request mapping paths that are not patterns.

Overrides:
  `getDirectPaths` in class `AbstractHandlerMethodMapping<RequestMappingInfo>`

### getMatchingMapping

@Nullable protected RequestMappingInfo getMatchingMapping(RequestMappingInfo info, 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 Comparator<RequestMappingInfo> getMappingComparator(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`)

### getHandlerInternal

@Nullable protected org.springframework.web.method.HandlerMethod getHandlerInternal(HttpServletRequest request) throws Exception
Description copied from class: `AbstractHandlerMethodMapping`
Look up a handler method for the given request.

Overrides:
  `getHandlerInternal` in class `AbstractHandlerMethodMapping<RequestMappingInfo>`
Parameters:
  `request` - current HTTP request
Returns:
  the corresponding handler instance, or `null` if none found
Throws:
  `Exception` - if there is an internal error

### handleMatch

protected void handleMatch(RequestMappingInfo info, String lookupPath, HttpServletRequest request)
Expose URI template variables, matrix 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.MATRIX_VARIABLES_ATTRIBUTE`
  - `HandlerMapping.PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE`

### handleNoMatch

@Nullable protected org.springframework.web.method.HandlerMethod handleNoMatch(Set<RequestMappingInfo> infos, String lookupPath, HttpServletRequest request) throws ServletException
Iterate all RequestMappingInfo's once again, look if any match by URL at least and raise exceptions according to what doesn't match.

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