public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMapping implements EmbeddedValueResolverAware
RequestMappingInfoHandlerMapping that creates
RequestMappingInfo instances from class-level and method-level
@RequestMapping annotations.loggerBEST_MATCHING_HANDLER_ATTRIBUTE, BEST_MATCHING_PATTERN_ATTRIBUTE, MATRIX_VARIABLES_ATTRIBUTE, PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE, URI_TEMPLATE_VARIABLES_ATTRIBUTEHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| Constructor and Description |
|---|
RequestMappingHandlerMapping() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Detects handler methods at initialization.
|
protected RequestMappingInfo |
createRequestMappingInfo(RequestMapping requestMapping,
RequestCondition<?> customCondition)
Create a
RequestMappingInfo from the supplied
@RequestMapping annotation, which is either
a directly declared annotation, a meta-annotation, or the synthesized
result of merging annotation attributes within an annotation hierarchy. |
RequestedContentTypeResolver |
getContentTypeResolver()
Return the configured
RequestedContentTypeResolver. |
protected RequestCondition<?> |
getCustomMethodCondition(Method method)
Provide a custom method-level request condition.
|
protected RequestCondition<?> |
getCustomTypeCondition(Class<?> handlerType)
Provide a custom type-level request condition.
|
protected RequestMappingInfo |
getMappingForMethod(Method method,
Class<?> handlerType)
Uses method and type-level @
RequestMapping annotations to create
the RequestMappingInfo. |
protected CorsConfiguration |
initCorsConfiguration(Object handler,
Method method,
RequestMappingInfo mappingInfo)
Extract and return the CORS configuration for the mapping.
|
protected boolean |
isHandler(Class<?> beanType)
Whether the given type is a handler with handler methods.
|
protected String[] |
resolveEmbeddedValuesInPatterns(String[] patterns)
Resolve placeholder values in the given array of patterns.
|
void |
setContentTypeResolver(RequestedContentTypeResolver contentTypeResolver)
Set the
RequestedContentTypeResolver to use to determine requested
media types. |
void |
setEmbeddedValueResolver(StringValueResolver resolver)
Set the StringValueResolver to use for resolving embedded definition values.
|
getMappingComparator, getMatchingMapping, handleMatch, handleNoMatchcreateHandlerMethod, detectHandlerMethods, getCorsConfiguration, getHandlerInternal, getHandlerMethods, handlerMethodsInitialized, initHandlerMethods, lookupHandlerMethod, registerHandlerMethod, registerMapping, unregisterMappinggetCorsProcessor, getHandler, getOrder, getPathPatternParser, setCorsConfigurations, setCorsProcessor, setOrder, setUseCaseSensitiveMatch, setUseTrailingSlashMatchgetApplicationContext, getMessageSourceAccessor, initApplicationContext, initApplicationContext, isContextRequired, obtainApplicationContext, requiredContextClass, setApplicationContextpublic void setContentTypeResolver(RequestedContentTypeResolver contentTypeResolver)
RequestedContentTypeResolver to use to determine requested
media types. If not set, the default constructor is used.public RequestedContentTypeResolver getContentTypeResolver()
RequestedContentTypeResolver.public void setEmbeddedValueResolver(StringValueResolver resolver)
EmbeddedValueResolverAwaresetEmbeddedValueResolver in interface EmbeddedValueResolverAwarepublic void afterPropertiesSet()
AbstractHandlerMethodMappingafterPropertiesSet in interface InitializingBeanafterPropertiesSet in class AbstractHandlerMethodMapping<RequestMappingInfo>protected boolean isHandler(Class<?> beanType)
Controller annotation.isHandler in class AbstractHandlerMethodMapping<RequestMappingInfo>beanType - the type of the bean being checkedprotected RequestMappingInfo getMappingForMethod(Method method, Class<?> handlerType)
RequestMapping annotations to create
the RequestMappingInfo.getMappingForMethod in class AbstractHandlerMethodMapping<RequestMappingInfo>method - the method to provide a mapping forhandlerType - the handler type, possibly a sub-type of the method's
declaring classnull if the method
does not have a @RequestMapping annotation.getCustomMethodCondition(Method),
getCustomTypeCondition(Class)@Nullable protected RequestCondition<?> getCustomTypeCondition(Class<?> handlerType)
RequestCondition can be of any type so long as the
same condition type is returned from all calls to this method in order
to ensure custom request conditions can be combined and compared.
Consider extending
AbstractRequestCondition for custom condition types and using
CompositeRequestCondition to provide multiple custom conditions.
handlerType - the handler type for which to create the conditionnull@Nullable protected RequestCondition<?> getCustomMethodCondition(Method method)
RequestCondition can be of any type so long as the
same condition type is returned from all calls to this method in order
to ensure custom request conditions can be combined and compared.
Consider extending
AbstractRequestCondition for custom condition types and using
CompositeRequestCondition to provide multiple custom conditions.
method - the handler method for which to create the conditionnullprotected RequestMappingInfo createRequestMappingInfo(RequestMapping requestMapping, @Nullable RequestCondition<?> customCondition)
RequestMappingInfo from the supplied
@RequestMapping annotation, which is either
a directly declared annotation, a meta-annotation, or the synthesized
result of merging annotation attributes within an annotation hierarchy.protected String[] resolveEmbeddedValuesInPatterns(String[] patterns)
protected CorsConfiguration initCorsConfiguration(Object handler, Method method, RequestMappingInfo mappingInfo)
AbstractHandlerMethodMappinginitCorsConfiguration in class AbstractHandlerMethodMapping<RequestMappingInfo>