类 ControllerClassNameHandlerMapping
- 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.AbstractUrlHandlerMapping
- org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping
- org.springframework.web.servlet.mvc.support.AbstractControllerUrlHandlerMapping
- org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping
- 所有已实现的接口:
Aware
,ApplicationContextAware
,Ordered
,ServletContextAware
,MatchableHandlerMapping
,HandlerMapping
@Deprecated public class ControllerClassNameHandlerMapping extends AbstractControllerUrlHandlerMapping
已过时。as of 4.3, in favor of annotation-driven handler methodsImplementation ofHandlerMapping
that follows a simple convention for generating URL path mappings from the class names of registeredController
beans as well as@Controller
annotated beans.For simple
Controller
implementations (those that handle a single request type), the convention is to take theshort name
of theClass
, remove the 'Controller' suffix if it exists and return the remaining text, lower-cased, as the mapping, with a leading/
. For example:WelcomeController
->/welcome*
HomeController
->/home*
For
MultiActionController MultiActionControllers
and@Controller
beans, a similar mapping is registered, except that all sub-paths are registered using the trailing wildcard pattern/*
. For example:WelcomeController
->/welcome
,/welcome/*
CatalogController
->/catalog
,/catalog/*
For
MultiActionController
it is often useful to use this mapping strategy in conjunction with theInternalPathMethodNameResolver
.Thanks to Warren Oliver for suggesting the "caseSensitive", "pathPrefix" and "basePackage" properties which have been added in Spring 2.5.
- 从以下版本开始:
- 2.0
- 作者:
- Rob Harrop, Juergen Hoeller
- 另请参阅:
Controller
,MultiActionController
字段概要
从类继承的字段 org.springframework.context.support.ApplicationObjectSupport
logger
从接口继承的字段 org.springframework.web.servlet.HandlerMapping
BEST_MATCHING_HANDLER_ATTRIBUTE, BEST_MATCHING_PATTERN_ATTRIBUTE, INTROSPECT_TYPE_LEVEL_MAPPING, MATRIX_VARIABLES_ATTRIBUTE, PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE, URI_TEMPLATE_VARIABLES_ATTRIBUTE
从接口继承的字段 org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
构造器概要
构造器 构造器 说明 ControllerClassNameHandlerMapping()
已过时。
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 protected String[]
buildUrlsForHandler(String beanName, Class<?> beanClass)
已过时。Abstract template method to be implemented by subclasses.protected String[]
generatePathMappings(Class<?> beanClass)
已过时。Generate the actual URL paths for the given controller class.void
setBasePackage(String basePackage)
已过时。Set the base package to be used for generating path mappings, including all subpackages underneath this packages as path elements.void
setCaseSensitive(boolean caseSensitive)
已过时。Set whether to apply case sensitivity to the generated paths, e.g. turning the class name "BuyForm" into "buyForm".void
setPathPrefix(String prefixPath)
已过时。Specify a prefix to prepend to the path generated from the controller name.从类继承的方法 org.springframework.web.servlet.mvc.support.AbstractControllerUrlHandlerMapping
determineUrlsForHandler, isControllerType, isEligibleForMapping, isMultiActionControllerType, setExcludedClasses, setExcludedPackages, setIncludeAnnotatedControllers
从类继承的方法 org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping
detectHandlers, initApplicationContext, setDetectHandlersInAncestorContexts
从类继承的方法 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping
buildPathExposingHandler, exposePathWithinMapping, exposeUriTemplateVariables, getHandlerInternal, getHandlerMap, getRootHandler, lookupHandler, match, registerHandler, registerHandler, setLazyInitHandlers, setRootHandler, setUseTrailingSlashMatch, supportsTypeLevelMappings, useTrailingSlashMatch, validateHandler
从类继承的方法 org.springframework.web.servlet.handler.AbstractHandlerMapping
adaptInterceptor, detectMappedInterceptors, extendInterceptors, getAdaptedInterceptors, getCorsConfiguration, getCorsConfigurations, getCorsHandlerExecutionChain, getCorsProcessor, getDefaultHandler, getHandler, getHandlerExecutionChain, getMappedInterceptors, getOrder, getPathMatcher, getUrlPathHelper, initInterceptors, setAlwaysUseFullPath, setCorsConfigurations, setCorsProcessor, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelper
从类继承的方法 org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
从类继承的方法 org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.web.servlet.HandlerMapping
getHandler
构造器详细资料
ControllerClassNameHandlerMapping
public ControllerClassNameHandlerMapping()
已过时。
方法详细资料
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive)
已过时。Set whether to apply case sensitivity to the generated paths, e.g. turning the class name "BuyForm" into "buyForm".Default is "false", using pure lower case paths, e.g. turning the class name "BuyForm" into "buyform".
setPathPrefix
public void setPathPrefix(String prefixPath)
已过时。Specify a prefix to prepend to the path generated from the controller name.Default is a plain slash ("/"). A path like "/mymodule" can be specified in order to have controller path mappings prefixed with that path, e.g. "/mymodule/buyform" instead of "/buyform" for the class name "BuyForm".
setBasePackage
public void setBasePackage(String basePackage)
已过时。Set the base package to be used for generating path mappings, including all subpackages underneath this packages as path elements.Default is
null
, using the short class name for the generated path, with the controller's package not represented in the path. Specify a base package like "com.mycompany.myapp" to include subpackages within that base package as path elements, e.g. generating the path "/mymodule/buyform" for the class name "com.mycompany.myapp.mymodule.BuyForm". Subpackage hierarchies are represented as individual path elements, e.g. "/mymodule/mysubmodule/buyform" for the class name "com.mycompany.myapp.mymodule.mysubmodule.BuyForm".
buildUrlsForHandler
protected String[] buildUrlsForHandler(String beanName, Class<?> beanClass)
已过时。从类复制的说明:AbstractControllerUrlHandlerMapping
Abstract template method to be implemented by subclasses.- 指定者:
buildUrlsForHandler
在类中AbstractControllerUrlHandlerMapping
- 参数:
beanName
- the name of the beanbeanClass
- the type of the bean- 返回:
- the URLs determined for the bean
generatePathMappings
protected String[] generatePathMappings(Class<?> beanClass)
已过时。Generate the actual URL paths for the given controller class.Subclasses may choose to customize the paths that are generated by overriding this method.
- 参数:
beanClass
- the controller bean class to generate a mapping for- 返回:
- the URL path mappings for the given controller