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.SimpleUrlHandlerMapping |
Implementation of the HandlerMapping
interface to map 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, like 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*"). Note that the default is
to map within the current servlet mapping if applicable; see the
"alwaysUseFullPath"
property for details.
For details on the pattern options, see the
AntPathMatcher
javadoc.
[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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Allow Map access to the URL path mappings, with the option to add or
override specific entries.
| |||||||||||
Calls the
registerHandlers(Map method in addition to the
superclass's initialization. | |||||||||||
Map URL paths to handler bean names.
| |||||||||||
Set a Map with URL paths as keys and handler beans (or handler bean names)
as values.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Register all handlers specified in the URL map for the corresponding paths.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.web.servlet.handler.AbstractUrlHandlerMapping
| |||||||||||
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
|
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.
Calls the registerHandlers(Map
method in addition to the
superclass's initialization.
BeansException |
---|
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 AntPathMatcher
javadoc.
mappings | properties with URLs as keys and bean names as values |
---|
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 AntPathMatcher
javadoc.
urlMap | map with URLs as keys and beans as values |
---|
Register all handlers specified in the URL map for the corresponding paths.
urlMap | Map with URL paths as keys and handler beans or bean names as values |
---|
BeansException | if a handler couldn't be registered |
---|---|
IllegalStateException | if there is a conflicting handler registered |