类 SimpleUrlHandlerMapping
- 所有已实现的接口:
cn.taketoday.beans.factory.Aware,cn.taketoday.beans.factory.BeanNameAware,cn.taketoday.context.ApplicationContextAware,cn.taketoday.context.expression.EmbeddedValueResolverAware,cn.taketoday.core.Ordered,HandlerMapping
HandlerMapping interface that maps from URLs
to request handler beans. Supports both mapping to bean instances and mapping
to bean names; the latter is required for non-singleton handlers.
The "urlMap" property is suitable for populating the handler map with bean references, e.g. via the map element in XML bean definitions.
Mappings to bean names can be set via the "mappings" property, in a form
accepted by the java.util.Properties class, as follows:
/welcome.html=ticketController /show.html=ticketController
The syntax is PATH=HANDLER_BEAN_NAME. If the path doesn't begin
with a slash, one is prepended.
Supports direct matches (given "/test" -> registered "/test") and "*"
matches (given "/test" -> registered "/t*"). For details on the pattern
options, see the PathPattern javadoc.
- 从以下版本开始:
- 3.0
- 作者:
- Rod Johnson, Juergen Hoeller, Sam Brannen, TODAY 2020/12/23 17:21
- 另请参阅:
-
字段概要
字段从类继承的字段 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 aSimpleUrlHandlerMappingwith default settings.SimpleUrlHandlerMapping(Map<String, ?> urlMap) Create aSimpleUrlHandlerMappingusing the supplied URL map.SimpleUrlHandlerMapping(Map<String, ?> urlMap, int order) Create aSimpleUrlHandlerMappingusing the supplied URL map and order. -
方法概要
修饰符和类型方法说明Allow Map access to the URL path mappings, with the option to add or override specific entries.voidCalls theregisterHandlers(java.util.Map<java.lang.String, java.lang.Object>)method in addition to the superclass's initialization.private voidprotected voidregisterHandlers(Map<String, Object> urlMap) Register all handlers specified in the URL map for the corresponding paths.voidsetMappings(Properties mappings) Map URL paths to handler bean names.voidSet a Map with URL paths as keys and handler beans (or handler bean names) as values.从类继承的方法 cn.taketoday.web.handler.AbstractUrlHandlerMapping
doPutPathPattern, duPutHandler, getHandlerInternal, getHandlerMap, getPathPatternHandlerMap, getRootHandler, lookupHandler, registerHandler, registerHandler, setLazyInitHandlers, setRootHandler, validateHandler从类继承的方法 cn.taketoday.web.handler.AbstractHandlerMapping
detectMappedInterceptors, extendInterceptors, formatMappingName, getCorsConfiguration, getCorsConfigurationSource, getCorsHandlerExecutionChain, getCorsProcessor, getDefaultHandler, getHandler, getHandlerExecutionChain, getHandlerInterceptors, getOrder, getPatternParser, hasCorsConfigurationSource, 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
-
字段详细资料
-
urlMap
-
-
构造器详细资料
-
SimpleUrlHandlerMapping
public SimpleUrlHandlerMapping()Create aSimpleUrlHandlerMappingwith default settings.- 从以下版本开始:
- 4.0
-
SimpleUrlHandlerMapping
Create aSimpleUrlHandlerMappingusing the supplied URL map.- 参数:
urlMap- map with URL paths as keys and handler beans (or handler bean names) as values- 从以下版本开始:
- 4.0
- 另请参阅:
-
SimpleUrlHandlerMapping
Create aSimpleUrlHandlerMappingusing the supplied URL map and order.- 参数:
urlMap- map with URL paths as keys and handler beans (or handler bean names) as valuesorder- the order value for thisSimpleUrlHandlerMapping- 从以下版本开始:
- 4.0
- 另请参阅:
-
-
方法详细资料
-
setMappings
Map URL paths to handler bean names. This is the typical way of configuring this HandlerMapping.Supports direct URL matches and Ant-style pattern matches. For syntax details, see the
AntPathMatcherjavadoc.- 参数:
mappings- properties with URLs as keys and bean names as values- 从以下版本开始:
- 4.0
- 另请参阅:
-
setUrlMap
Set a Map with URL paths as keys and handler beans (or handler bean names) as values. Convenient for population with bean references.Supports direct URL matches and Ant-style pattern matches. For syntax details, see the
AntPathMatcherjavadoc.- 参数:
urlMap- map with URLs as keys and beans as values- 从以下版本开始:
- 4.0
- 另请参阅:
-
getUrlMap
Allow Map access to the URL path mappings, with the option to add or override specific entries.Useful for specifying entries directly, for example via "urlMap[myKey]". This is particularly useful for adding or overriding entries in child bean definitions.
- 从以下版本开始:
- 4.0
-
initApplicationContext
public void initApplicationContext() throws cn.taketoday.beans.BeansExceptionCalls theregisterHandlers(java.util.Map<java.lang.String, java.lang.Object>)method in addition to the superclass's initialization.- 覆盖:
initApplicationContext在类中AbstractHandlerMapping- 抛出:
cn.taketoday.beans.BeansException- 从以下版本开始:
- 4.0
- 另请参阅:
-
registerHandlers
Register all handlers specified in the URL map for the corresponding paths.- 参数:
urlMap- a Map with URL paths as keys and handler beans or bean names as values- 抛出:
cn.taketoday.beans.BeansException- if a handler couldn't be registeredIllegalStateException- if there is a conflicting handler registered
-
logMappings
private void logMappings()
-