T - the mapping for a HandlerMethod containing the conditions
 needed to match the handler method to an incoming request.public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMapping implements InitializingBean
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>.
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 | 
|---|
AbstractHandlerMethodMapping()  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
afterPropertiesSet()
Detects handler methods at initialization. 
 | 
protected HandlerMethod | 
createHandlerMethod(Object handler,
                   Method method)
Create the HandlerMethod instance. 
 | 
protected void | 
detectHandlerMethods(Object handler)
Look for handler methods in a handler. 
 | 
protected CorsConfiguration | 
getCorsConfiguration(Object handler,
                    ServerWebExchange exchange)
Retrieve the CORS configuration for the given handler. 
 | 
reactor.core.publisher.Mono<HandlerMethod> | 
getHandlerInternal(ServerWebExchange exchange)
Look up a handler method for the given request. 
 | 
Map<T,HandlerMethod> | 
getHandlerMethods()
Return a (read-only) map with all mappings and HandlerMethod's. 
 | 
protected abstract Comparator<T> | 
getMappingComparator(ServerWebExchange exchange)
Return a comparator for sorting matching mappings. 
 | 
protected abstract T | 
getMappingForMethod(Method method,
                   Class<?> handlerType)
Provide the mapping for a handler method. 
 | 
protected abstract T | 
getMatchingMapping(T mapping,
                  ServerWebExchange exchange)
Check if a mapping matches the current request and return a (potentially
 new) mapping with conditions relevant to the current request. 
 | 
protected void | 
handleMatch(T mapping,
           HandlerMethod handlerMethod,
           ServerWebExchange exchange)
Invoked when a matching mapping is found. 
 | 
protected HandlerMethod | 
handleNoMatch(Set<T> mappings,
             ServerWebExchange exchange)
Invoked when no matching mapping is not found. 
 | 
protected void | 
handlerMethodsInitialized(Map<T,HandlerMethod> handlerMethods)
Invoked after all handler methods have been detected. 
 | 
protected boolean | 
hasCorsConfigurationSource(Object handler)
Return  
true if there is a CorsConfigurationSource for this handler. | 
protected CorsConfiguration | 
initCorsConfiguration(Object handler,
                     Method method,
                     T mapping)
Extract and return the CORS configuration for the mapping. 
 | 
protected void | 
initHandlerMethods()
Scan beans in the ApplicationContext, detect and register handler methods. 
 | 
protected abstract boolean | 
isHandler(Class<?> beanType)
Whether the given type is a handler with handler methods. 
 | 
protected HandlerMethod | 
lookupHandlerMethod(ServerWebExchange exchange)
Look up the best-matching handler method for the current request. 
 | 
protected void | 
registerHandlerMethod(Object handler,
                     Method method,
                     T mapping)
Register a handler method and its unique mapping. 
 | 
void | 
registerMapping(T mapping,
               Object handler,
               Method method)
Register the given mapping. 
 | 
void | 
unregisterMapping(T mapping)
Un-register the given mapping. 
 | 
formatMappingName, getCorsProcessor, getHandler, getOrder, getPathPatternParser, setBeanName, setCorsConfigurations, setCorsConfigurationSource, setCorsProcessor, setOrder, setUseCaseSensitiveMatch, setUseTrailingSlashMatchgetApplicationContext, getMessageSourceAccessor, initApplicationContext, initApplicationContext, isContextRequired, obtainApplicationContext, requiredContextClass, setApplicationContextpublic Map<T,HandlerMethod> getHandlerMethods()
public void registerMapping(T mapping, Object handler, Method method)
This method may be invoked at runtime after initialization has completed.
mapping - the mapping for the handler methodhandler - the handlermethod - the methodpublic void unregisterMapping(T mapping)
This method may be invoked at runtime after initialization has completed.
mapping - the mapping to unregisterpublic void afterPropertiesSet()
afterPropertiesSet in interface InitializingBeanprotected void initHandlerMethods()
protected void detectHandlerMethods(Object handler)
handler - the bean name of a handler or a handler instanceprotected void registerHandlerMethod(Object handler, Method method, T mapping)
handler - the bean name of the handler or the handler instancemethod - the method to registermapping - the mapping conditions associated with the handler methodIllegalStateException - if another method was already registered
 under the same mappingprotected HandlerMethod createHandlerMethod(Object handler, Method method)
handler - either a bean name or an actual handler instancemethod - the target method@Nullable protected CorsConfiguration initCorsConfiguration(Object handler, Method method, T mapping)
protected void handlerMethodsInitialized(Map<T,HandlerMethod> handlerMethods)
handlerMethods - a read-only map with handler methods and mappings.public reactor.core.publisher.Mono<HandlerMethod> getHandlerInternal(ServerWebExchange exchange)
getHandlerInternal in class AbstractHandlerMappingexchange - the current exchangeMono for the matching handler, if any@Nullable protected HandlerMethod lookupHandlerMethod(ServerWebExchange exchange) throws Exception
exchange - the current exchangenull if no matchExceptionhandleMatch(T, org.springframework.web.method.HandlerMethod, org.springframework.web.server.ServerWebExchange), 
handleNoMatch(java.util.Set<T>, org.springframework.web.server.ServerWebExchange)protected void handleMatch(T mapping, HandlerMethod handlerMethod, ServerWebExchange exchange)
mapping - the matching mappinghandlerMethod - the matching methodexchange - the current exchange@Nullable protected HandlerMethod handleNoMatch(Set<T> mappings, ServerWebExchange exchange) throws Exception
mappings - all registered mappingsexchange - the current exchangenullException - provides details that can be translated into an error status codeprotected boolean hasCorsConfigurationSource(Object handler)
AbstractHandlerMappingtrue if there is a CorsConfigurationSource for this handler.hasCorsConfigurationSource in class AbstractHandlerMappingprotected CorsConfiguration getCorsConfiguration(Object handler, ServerWebExchange exchange)
AbstractHandlerMappinggetCorsConfiguration in class AbstractHandlerMappinghandler - the handler to check (never null)exchange - the current exchangenull if noneprotected abstract boolean isHandler(Class<?> beanType)
beanType - the type of the bean being checked@Nullable protected abstract T getMappingForMethod(Method method, Class<?> handlerType)
method - the method to provide a mapping forhandlerType - the handler type, possibly a sub-type of the method's
 declaring classnull if the method is not mapped@Nullable protected abstract T getMatchingMapping(T mapping, ServerWebExchange exchange)
mapping - the mapping to get a match forexchange - the current exchangenull if the mapping doesn't matchprotected abstract Comparator<T> getMappingComparator(ServerWebExchange exchange)
exchange - the current exchangenull)