类 RequestMappingHandlerMapping
- 所有已实现的接口:
cn.taketoday.beans.factory.Aware,cn.taketoday.beans.factory.BeanNameAware,cn.taketoday.beans.factory.InitializingBean,cn.taketoday.context.ApplicationContextAware,cn.taketoday.context.expression.EmbeddedValueResolverAware,cn.taketoday.core.Ordered,HandlerMapping
RequestMappingInfo instances from type and method-level
@RequestMapping annotations in
@Controller classes.- 从以下版本开始:
- 4.0 2022/4/1 22:38
- 作者:
- Arjen Poutsma, Rossen Stoyanchev, Sam Brannen, Harry Yang
-
嵌套类概要
从类继承的嵌套类/接口 cn.taketoday.web.handler.method.AbstractHandlerMethodMapping
AbstractHandlerMethodMapping.MappingRegistration<T>, AbstractHandlerMethodMapping.MappingRegistry, AbstractHandlerMethodMapping.Match<T> -
字段概要
字段修饰符和类型字段说明private final RequestMappingInfo.BuilderConfigurationprivate ContentNegotiationManagerprivate static final HttpMethod[]private ResolvableParameterFactoryprivate cn.taketoday.core.ParameterNameDiscovererprivate ParameterResolvingRegistry从类继承的字段 cn.taketoday.web.handler.method.AbstractHandlerMethodMapping
mappingRegistry从类继承的字段 cn.taketoday.web.handler.AbstractHandlerMapping
embeddedValueResolver, mappingsLogger从类继承的字段 cn.taketoday.context.support.ApplicationObjectSupport
applicationContext, log, messageSourceAccessor从接口继承的字段 cn.taketoday.web.HandlerMapping
HANDLER_MAPPING_BEAN_NAME从接口继承的字段 cn.taketoday.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidDetects handler methods at initialization.protected HandlerMethodcreateHandlerMethod(Object handler, Method method) Create the HandlerMethod instance.protected RequestMappingInfocreateRequestMappingInfo(RequestMapping requestMapping, RequestCondition<?> customCondition) Create aRequestMappingInfofrom the supplied@RequestMappingannotation, which is either a directly declared annotation, a meta-annotation, or the synthesized result of merging annotation attributes within an annotation hierarchy.protected RequestMappingInfocreateRequestMappingInfo(HttpExchange httpExchange, RequestCondition<?> customCondition) Create aRequestMappingInfofrom the supplied@HttpExchangeannotation, or meta-annotation, or synthesized result of merging annotation attributes within an annotation hierarchy.private RequestMappingInfocreateRequestMappingInfo(AnnotatedElement element) Delegates tocreateRequestMappingInfo(RequestMapping, RequestCondition), supplying the appropriate customRequestConditiondepending on whether the suppliedannotatedElementis a class or method.Obtain aRequestMappingInfo.BuilderConfigurationthat can reflects the internal configuration of thisHandlerMappingand can be used to setRequestMappingInfo.Builder.options(RequestMappingInfo.BuilderConfiguration).Return the configuredContentNegotiationManager.protected RequestCondition<?>getCustomCondition(AnnotatedElement element) Provide a custom method-level or type-level request condition.protected RequestMappingInfogetMappingForMethod(Method method, Class<?> handlerType) Uses method and type-level @RequestMappingannotations to create the RequestMappingInfo.(专用程序包) StringgetPathPrefix(Class<?> handlerType) The configured path prefixes as a read-only, possibly empty map.protected CorsConfigurationinitCorsConfiguration(Object handler, HandlerMethod handlerMethod, Method method, RequestMappingInfo mappingInfo) Extract and return the CORS configuration for the mapping.protected booleanWhether the given type is a handler with handler methods.protected voidregisterHandlerMethod(Object handler, Method method, RequestMappingInfo mapping) Register a handler method and its unique mapping.voidregisterMapping(RequestMappingInfo mapping, Object handler, Method method) Register the given mapping.private StringresolveCorsAnnotationValue(String value) protected String[]resolveEmbeddedValuesInPatterns(String[] patterns) Resolve placeholder values in the given array of patterns.voidsetContentNegotiationManager(ContentNegotiationManager contentNegotiationManager) Set theContentNegotiationManagerto use to determine requested media types.voidsetParameterNameDiscoverer(cn.taketoday.core.ParameterNameDiscoverer parameterNameDiscoverer) Set the ParameterNameDiscoverer to use for resolving method parameter names if needed (e.g. for default attribute names).voidsetPathPrefixes(Map<String, Predicate<Class<?>>> prefixes) Configure path prefixes to apply to controller methods.voidsetResolvingRegistry(ParameterResolvingRegistry resolvingRegistry) private static HttpMethod[]toMethodArray(String method) private static String[]toStringArray(String value) private voidupdateConsumesCondition(RequestMappingInfo info, Method method) private voidupdateCorsConfig(CorsConfiguration config, CrossOrigin annotation) 从类继承的方法 cn.taketoday.web.handler.method.RequestMappingInfoHandlerMapping
getDirectPaths, getMappingComparator, getMatchingMapping, handleMatch, handleNoMatch从类继承的方法 cn.taketoday.web.handler.method.AbstractHandlerMethodMapping
detectHandlerMethods, getCandidateBeanNames, getCorsConfiguration, getHandlerInterceptors, getHandlerInternal, getHandlerMethods, getHandlerMethodsForMappingName, getInterceptors, getNamingStrategy, handlerMethodsInitialized, hasCorsConfigurationSource, initHandlerMethods, lookupHandlerMethod, processCandidateBean, setDetectHandlerMethodsInAncestorContexts, setHandlerMethodMappingNamingStrategy, setUseInheritedInterceptor, unregisterMapping从类继承的方法 cn.taketoday.web.handler.AbstractHandlerMapping
detectMappedInterceptors, extendInterceptors, formatMappingName, getCorsConfigurationSource, getCorsHandlerExecutionChain, getCorsProcessor, getDefaultHandler, getHandler, getHandlerExecutionChain, getOrder, getPatternParser, initApplicationContext, resolveEmbeddedVariables, setBeanName, setCorsConfigurations, setCorsConfigurationSource, setCorsProcessor, setDefaultHandler, setEmbeddedValueResolver, setInterceptors, setOrder, setUseCaseSensitiveMatch, setUseTrailingSlashMatch从类继承的方法 cn.taketoday.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, isContextRequired, obtainApplicationContext, requiredContextClass, setApplicationContext, unwrapContext, unwrapFactory
-
字段详细资料
-
EMPTY_REQUEST_METHOD_ARRAY
-
pathPrefixes
-
contentNegotiationManager
-
config
-
resolvingRegistry
-
parameterFactory
-
parameterNameDiscoverer
private cn.taketoday.core.ParameterNameDiscoverer parameterNameDiscoverer
-
-
构造器详细资料
-
RequestMappingHandlerMapping
public RequestMappingHandlerMapping()
-
-
方法详细资料
-
setPathPrefixes
Configure path prefixes to apply to controller methods.Prefixes are used to enrich the mappings of every
@RequestMappingmethod whose controller type is matched by the correspondingPredicate. The prefix for the first matching predicate is used.Consider using
HandlerTypePredicateto group controllers.- 参数:
prefixes- a map with path prefixes as key
-
getPathPrefixes
The configured path prefixes as a read-only, possibly empty map. -
setContentNegotiationManager
Set theContentNegotiationManagerto use to determine requested media types. If not set, the default constructor is used. -
getContentNegotiationManager
Return the configuredContentNegotiationManager. -
setParameterNameDiscoverer
public void setParameterNameDiscoverer(cn.taketoday.core.ParameterNameDiscoverer parameterNameDiscoverer) Set the ParameterNameDiscoverer to use for resolving method parameter names if needed (e.g. for default attribute names).Default is a
DefaultParameterNameDiscoverer. -
setResolvingRegistry
-
afterPropertiesSet
public void afterPropertiesSet()从类复制的说明:AbstractHandlerMethodMappingDetects handler methods at initialization.- 指定者:
afterPropertiesSet在接口中cn.taketoday.beans.factory.InitializingBean- 覆盖:
afterPropertiesSet在类中AbstractHandlerMethodMapping<RequestMappingInfo>- 另请参阅:
-
getBuilderConfiguration
Obtain aRequestMappingInfo.BuilderConfigurationthat can reflects the internal configuration of thisHandlerMappingand can be used to setRequestMappingInfo.Builder.options(RequestMappingInfo.BuilderConfiguration).This is useful for programmatic registration of request mappings via
registerHandlerMethod(Object, Method, RequestMappingInfo).- 返回:
- the builder configuration that reflects the internal state
-
isHandler
Whether the given type is a handler with handler methods.Expects a handler to have either a type-level @
Controllerannotation or a type-level @RequestMappingannotation.- 指定者:
isHandler在类中AbstractHandlerMethodMapping<RequestMappingInfo>- 参数:
beanType- the type of the bean being checked- 返回:
- "true" if this a handler type, "false" otherwise.
-
createHandlerMethod
从类复制的说明:AbstractHandlerMethodMappingCreate the HandlerMethod instance.- 覆盖:
createHandlerMethod在类中AbstractHandlerMethodMapping<RequestMappingInfo>- 参数:
handler- either a bean name or an actual handler instancemethod- the target method- 返回:
- the created HandlerMethod
-
getMappingForMethod
Uses method and type-level @RequestMappingannotations to create the RequestMappingInfo.- 指定者:
getMappingForMethod在类中AbstractHandlerMethodMapping<RequestMappingInfo>- 参数:
method- the method to provide a mapping forhandlerType- the handler type, possibly a sub-type of the method's declaring class- 返回:
- the created RequestMappingInfo, or
nullif the method does not have a@RequestMappingannotation. - 另请参阅:
-
getPathPrefix
-
createRequestMappingInfo
Delegates tocreateRequestMappingInfo(RequestMapping, RequestCondition), supplying the appropriate customRequestConditiondepending on whether the suppliedannotatedElementis a class or method. -
getCustomCondition
Provide a custom method-level or type-level request condition. The customRequestConditioncan 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
AbstractRequestConditionfor custom condition types and usingCompositeRequestConditionto provide multiple custom conditions.- 参数:
element- the handler method or handler type for which to create the condition- 返回:
- the condition, or
null
-
createRequestMappingInfo
protected RequestMappingInfo createRequestMappingInfo(RequestMapping requestMapping, @Nullable RequestCondition<?> customCondition) Create aRequestMappingInfofrom the supplied@RequestMappingannotation, which is either a directly declared annotation, a meta-annotation, or the synthesized result of merging annotation attributes within an annotation hierarchy. -
createRequestMappingInfo
protected RequestMappingInfo createRequestMappingInfo(HttpExchange httpExchange, @Nullable RequestCondition<?> customCondition) Create aRequestMappingInfofrom the supplied@HttpExchangeannotation, or meta-annotation, or synthesized result of merging annotation attributes within an annotation hierarchy. -
toStringArray
-
toMethodArray
-
resolveEmbeddedValuesInPatterns
Resolve placeholder values in the given array of patterns.- 返回:
- a new array with updated patterns
-
registerMapping
从类复制的说明:AbstractHandlerMethodMappingRegister the given mapping.This method may be invoked at runtime after initialization has completed.
- 覆盖:
registerMapping在类中AbstractHandlerMethodMapping<RequestMappingInfo>- 参数:
mapping- the mapping for the handler methodhandler- the handlermethod- the method
-
registerHandlerMethod
Register a handler method and its unique mapping. Invoked at startup for each detected handler method.Note: To create the
RequestMappingInfo, please usegetBuilderConfiguration()and set the options onRequestMappingInfo.Builder.options(RequestMappingInfo.BuilderConfiguration)to match how thisHandlerMappingis configured. This is important for example to ensure use ofPathPatternorPathMatcherbased matching.- 覆盖:
registerHandlerMethod在类中AbstractHandlerMethodMapping<RequestMappingInfo>- 参数:
handler- the bean name of the handler or the handler instancemethod- the method to registermapping- the mapping conditions associated with the handler method
-
updateConsumesCondition
-
initCorsConfiguration
protected CorsConfiguration initCorsConfiguration(Object handler, HandlerMethod handlerMethod, Method method, RequestMappingInfo mappingInfo) 从类复制的说明:AbstractHandlerMethodMappingExtract and return the CORS configuration for the mapping. -
updateCorsConfig
-
resolveCorsAnnotationValue
-