Class AbstractHandlerMethodMapping<T>
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<T>
- Type Parameters:
T- the mapping for aHandlerMethodcontaining the conditions needed to match the handler method to an incoming request.
- All Implemented Interfaces:
Aware,BeanNameAware,InitializingBean,ApplicationContextAware,Ordered,ServletContextAware,HandlerMapping
- Direct Known Subclasses:
RequestMappingInfoHandlerMapping
public abstract class AbstractHandlerMethodMapping<T>
extends AbstractHandlerMapping
implements InitializingBean
Abstract base class for
HandlerMapping implementations that define
a mapping between a request and a HandlerMethod.
For each registered handler method, a unique mapping is maintained with
subclasses defining the details of the mapping type <T>.
- Since:
- 3.1
- Author:
- Arjen Poutsma, Rossen Stoyanchev, Juergen Hoeller, Sam Brannen
-
Field Summary
Fields inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping
mappingsLoggerFields inherited from class org.springframework.context.support.ApplicationObjectSupport
loggerFields 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_ATTRIBUTEFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDetects handler methods at initialization.protected HandlerMethodcreateHandlerMethod(Object handler, Method method) Create the HandlerMethod instance.protected voiddetectHandlerMethods(Object handler) Look for handler methods in the specified handler bean.protected String[]Determine the names of candidate beans in the application context.protected CorsConfigurationgetCorsConfiguration(Object handler, HttpServletRequest request) Retrieve the CORS configuration for the given handler.getDirectPaths(T mapping) Return the request mapping paths that are not patterns.protected HandlerMethodgetHandlerInternal(HttpServletRequest request) Look up a handler method for the given request.Return a (read-only) map with all mappings and HandlerMethod's.getHandlerMethodsForMappingName(String mappingName) Return the handler methods for the given mapping name.protected abstract Comparator<T>getMappingComparator(HttpServletRequest request) Return a comparator for sorting matching mappings.protected abstract TgetMappingForMethod(Method method, Class<?> handlerType) Provide the mapping for a handler method.getMappingPathPatterns(T mapping) Deprecated.protected abstract TgetMatchingMapping(T mapping, HttpServletRequest request) Check if a mapping matches the current request and return a (potentially new) mapping with conditions relevant to the current request.Return the configured naming strategy ornull.protected voidhandleMatch(T mapping, String lookupPath, HttpServletRequest request) Invoked when a matching mapping is found.protected HandlerMethodhandleNoMatch(Set<T> mappings, String lookupPath, HttpServletRequest request) Invoked when no matching mapping is not found.protected voidhandlerMethodsInitialized(Map<T, HandlerMethod> handlerMethods) Invoked after all handler methods have been detected.protected booleanhasCorsConfigurationSource(Object handler) Returntrueif there is aCorsConfigurationSourcefor this handler.protected CorsConfigurationinitCorsConfiguration(Object handler, Method method, T mapping) Extract and return the CORS configuration for the mapping.protected voidScan beans in the ApplicationContext, detect and register handler methods.protected abstract booleanWhether the given type is a handler with handler methods.protected HandlerMethodlookupHandlerMethod(String lookupPath, HttpServletRequest request) Look up the best-matching handler method for the current request.protected voidprocessCandidateBean(String beanName) Determine the type of the specified candidate bean and calldetectHandlerMethods(java.lang.Object)if identified as a handler type.protected voidregisterHandlerMethod(Object handler, Method method, T mapping) Register a handler method and its unique mapping.voidregisterMapping(T mapping, Object handler, Method method) Register the given mapping.voidsetDetectHandlerMethodsInAncestorContexts(boolean detectHandlerMethodsInAncestorContexts) Whether to detect handler methods in beans in ancestor ApplicationContexts.voidsetHandlerMethodMappingNamingStrategy(HandlerMethodMappingNamingStrategy<T> namingStrategy) Configure the naming strategy to use for assigning a default name to every mapped handler method.voidsetPatternParser(PathPatternParser patternParser) Set thePathPatternParserto parsepatternswith for URL path matching.voidunregisterMapping(T mapping) Un-register the given mapping.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,
getDirectPaths(Object)instead