类 RouterFunctionMapping
- 所有已实现的接口:
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
HandlerMapping implementation that supports RouterFunctions.
If no RouterFunction is provided at
construction time, this mapping
will detect all router functions in the application context, and consult them in
order.
- 从以下版本开始:
- 4.0
- 作者:
- Arjen Poutsma, Sebastien Deleuze, Brian Clozel, Harry Yang
-
字段概要
字段从类继承的字段 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 -
构造器概要
构造器构造器说明Create an emptyRouterFunctionMapping.RouterFunctionMapping(RouterFunction<?> routerFunction) Create aRouterFunctionMappingwith the givenRouterFunction. -
方法概要
修饰符和类型方法说明voidprotected ObjectgetHandlerInternal(RequestContext context) Look up a handler for the given request, returningnullif no specific one is found.Return the configuredRouterFunction.private voidInitializes a default set of message converters.private voidDetect all router functions in the current application context.private voidlogRouterFunctions(List<RouterFunction> routerFunctions) voidsetDetectHandlerFunctionsInAncestorContexts(boolean detectHandlerFunctionsInAncestorContexts) Set whether to detect handler functions in ancestor ApplicationContexts.voidsetMessageConverters(List<HttpMessageConverter<?>> messageConverters) Set the message body converters to use.voidsetRouterFunction(RouterFunction<?> routerFunction) Set the router function to map to.从类继承的方法 cn.taketoday.web.handler.AbstractHandlerMapping
detectMappedInterceptors, extendInterceptors, formatMappingName, getCorsConfiguration, getCorsConfigurationSource, getCorsHandlerExecutionChain, getCorsProcessor, getDefaultHandler, getHandler, getHandlerExecutionChain, getHandlerInterceptors, getOrder, getPatternParser, hasCorsConfigurationSource, 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
-
字段详细资料
-
routerFunction
-
messageConverters
-
detectHandlerFunctionsInAncestorContexts
private boolean detectHandlerFunctionsInAncestorContexts
-
-
构造器详细资料
-
RouterFunctionMapping
public RouterFunctionMapping()Create an emptyRouterFunctionMapping.If this constructor is used, this mapping will detect all
RouterFunctioninstances available in the application context. -
RouterFunctionMapping
Create aRouterFunctionMappingwith the givenRouterFunction.If this constructor is used, no application context detection will occur.
- 参数:
routerFunction- the router function to use for mapping
-
-
方法详细资料
-
setRouterFunction
Set the router function to map to.If this property is used, no application context detection will occur.
-
getRouterFunction
Return the configuredRouterFunction.Note: When router functions are detected from the ApplicationContext, this method may return
nullif invoked prior toafterPropertiesSet().- 返回:
- the router function or
null
-
setMessageConverters
Set the message body converters to use.These converters are used to convert from and to HTTP requests and responses.
-
setDetectHandlerFunctionsInAncestorContexts
public void setDetectHandlerFunctionsInAncestorContexts(boolean detectHandlerFunctionsInAncestorContexts) Set whether to detect handler functions in ancestor ApplicationContexts.Default is "false": Only handler functions in the current ApplicationContext will be detected, i.e. only in the context that this HandlerMapping itself is defined in (typically the current DispatcherServlet's context).
Switch this flag on to detect handler beans in ancestor contexts (typically the Infra root WebApplicationContext) as well.
-
afterPropertiesSet
- 指定者:
afterPropertiesSet在接口中cn.taketoday.beans.factory.InitializingBean- 抛出:
Exception
-
initRouterFunctions
private void initRouterFunctions()Detect all router functions in the current application context. -
logRouterFunctions
-
initMessageConverters
private void initMessageConverters()Initializes a default set of message converters. -
getHandlerInternal
从类复制的说明:AbstractHandlerMappingLook up a handler for the given request, returningnullif no specific one is found. This method is called byAbstractHandlerMapping.getHandler(cn.taketoday.web.RequestContext); anullreturn value will lead to the default handler, if one is set.On CORS pre-flight requests this method should return a match not for the pre-flight request but for the expected actual request based on the URL path, the HTTP methods from the "Access-Control-Request-Method" header, and the headers from the "Access-Control-Request-Headers" header thus allowing the CORS configuration to be obtained via
AbstractHandlerMapping.getCorsConfiguration(Object, RequestContext),Note: This method may also return a pre-built
HandlerExecutionChain, combining a handler object with dynamically determined interceptors. Statically specified interceptors will get merged into such an existing chain.- 指定者:
getHandlerInternal在类中AbstractHandlerMapping- 参数:
context- current HTTP request- 返回:
- the corresponding handler instance, or
nullif none found - 抛出:
Exception- if there is an internal error
-