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 |
Known Direct Subclasses |
Known Indirect Subclasses |
Abstract base class for URL-mapped HandlerMapping
implementations. Provides infrastructure for mapping handlers to URLs and configurable
URL lookup. For information on the latter, see "alwaysUseFullPath" property.
Supports direct matches, e.g. a registered "/test" matches "/test", and
various Ant-style pattern matches, e.g. a registered "/t*" pattern matches
both "/test" and "/team", "/test/*" matches all paths in the "/test" directory,
"/test/**" matches all paths below "/test". For details, see the
AntPathMatcher
javadoc.
Will search all path patterns to find the most exact match for the current request path. The most exact match is defined as the longest path pattern that matches the current request path.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
org.springframework.core.Ordered
|
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.context.support.ApplicationObjectSupport
| |||||||||||
From interface
org.springframework.web.servlet.HandlerMapping
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return the registered handlers as an unmodifiable Map, with the registered path
as key and the handler object (or handler bean name in case of a lazy-init handler)
as value.
| |||||||||||
Return the PathMatcher implementation to use for matching URL paths
against registered URL patterns.
| |||||||||||
Return the root handler for this handler mapping (registered for "/"),
or
null if none. | |||||||||||
Set if URL lookup should always use the full path within the current servlet
context.
| |||||||||||
Set whether to lazily initialize handlers.
| |||||||||||
Set the PathMatcher implementation to use for matching URL paths
against registered URL patterns.
| |||||||||||
Set the root handler for this handler mapping, that is,
the handler to be registered for the root path ("/").
| |||||||||||
Set if context path and request URI should be URL-decoded.
| |||||||||||
Set the UrlPathHelper to use for resolution of lookup paths.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Build a handler object for the given raw handler, exposing the actual
handler, the
PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE , as well as
the URI_TEMPLATE_VARIABLES_ATTRIBUTE before executing the handler. | |||||||||||
Expose the path within the current mapping as request attribute.
| |||||||||||
Expose the URI templates variables as request attribute.
| |||||||||||
Look up a handler for the URL path of the given request.
| |||||||||||
Initialize the specified interceptors, adapting them where necessary.
| |||||||||||
Look up a handler instance for the given URL path.
| |||||||||||
Register the specified handler for the given URL paths.
| |||||||||||
Register the specified handler for the given URL path.
| |||||||||||
Indicates whether this handler mapping support type-level mappings.
| |||||||||||
Validate the given handler against the current request.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.web.servlet.handler.AbstractHandlerMapping
| |||||||||||
From class
org.springframework.web.context.support.WebApplicationObjectSupport
| |||||||||||
From class
org.springframework.context.support.ApplicationObjectSupport
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.context.ApplicationContextAware
| |||||||||||
From interface
org.springframework.core.Ordered
| |||||||||||
From interface
org.springframework.web.context.ServletContextAware
| |||||||||||
From interface
org.springframework.web.servlet.HandlerMapping
|
Return the registered handlers as an unmodifiable Map, with the registered path as key and the handler object (or handler bean name in case of a lazy-init handler) as value.
Return the PathMatcher implementation to use for matching URL paths against registered URL patterns.
Return the root handler for this handler mapping (registered for "/"),
or null
if none.
Set if URL lookup should always use the full path within the current servlet context. Else, the path within the current servlet mapping is used if applicable (that is, in the case of a ".../*" servlet mapping in web.xml).
Default is "false".
Set whether to lazily initialize handlers. Only applicable to singleton handlers, as prototypes are always lazily initialized. Default is "false", as eager initialization allows for more efficiency through referencing the controller objects directly.
If you want to allow your controllers to be lazily initialized, make them "lazy-init" and set this flag to true. Just making them "lazy-init" will not work, as they are initialized through the references from the handler mapping in this case.
Set the PathMatcher implementation to use for matching URL paths against registered URL patterns. Default is AntPathMatcher.
Set the root handler for this handler mapping, that is, the handler to be registered for the root path ("/").
Default is null
, indicating no root handler.
Set if context path and request URI should be URL-decoded. Both are returned undecoded by the Servlet API, in contrast to the servlet path.
Uses either the request encoding or the default encoding according to the Servlet spec (ISO-8859-1).
Set the UrlPathHelper to use for resolution of lookup paths.
Use this to override the default UrlPathHelper with a custom subclass, or to share common UrlPathHelper settings across multiple HandlerMappings and MethodNameResolvers.
Build a handler object for the given raw handler, exposing the actual
handler, the PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE
, as well as
the URI_TEMPLATE_VARIABLES_ATTRIBUTE
before executing the handler.
The default implementation builds a HandlerExecutionChain
with a special interceptor that exposes the path attribute and uri template variables
rawHandler | the raw handler to expose |
---|---|
pathWithinMapping | the path to expose before executing the handler |
uriTemplateVariables | the URI template variables, can be null if no variables found |
Expose the path within the current mapping as request attribute.
pathWithinMapping | the path within the current mapping |
---|---|
request | the request to expose the path to |
Expose the URI templates variables as request attribute.
uriTemplateVariables | the URI template variables |
---|---|
request | the request to expose the path to |
Look up a handler for the URL path of the given request.
request | current HTTP request |
---|
null
if none found
Exception |
---|
Initialize the specified interceptors, adapting them where necessary.
Look up a handler instance for the given URL path.
Supports direct matches, e.g. a registered "/test" matches "/test", and various Ant-style pattern matches, e.g. a registered "/t*" matches both "/test" and "/team". For details, see the AntPathMatcher class.
Looks for the most exact pattern, where most exact is defined as the longest path pattern.
urlPath | URL the bean is mapped to |
---|---|
request | current HTTP request (to expose the path within the mapping to) |
null
if not foundException |
---|
Register the specified handler for the given URL paths.
urlPaths | the URLs that the bean should be mapped to |
---|---|
beanName | the name of the handler bean |
BeansException | if the handler couldn't be registered |
---|---|
IllegalStateException | if there is a conflicting handler registered |
Register the specified handler for the given URL path.
urlPath | the URL the bean should be mapped to |
---|---|
handler | the handler instance or handler bean name String (a bean name will automatically be resolved into the corresponding handler bean) |
BeansException | if the handler couldn't be registered |
---|---|
IllegalStateException | if there is a conflicting handler registered |
Indicates whether this handler mapping support type-level mappings. Default to false
.
Validate the given handler against the current request.
The default implementation is empty. Can be overridden in subclasses, for example to enforce specific preconditions expressed in URL mappings.
handler | the handler object to validate |
---|---|
request | current HTTP request |
Exception | if validation failed |
---|