org.springframework.web.servlet.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 org.
javadoc.
setMappings, setUrlMap, BeanNameUrlHandlerMapping
| Access | Constructor and Description |
|---|---|
| public | |
| public | SimpleUrlHandlerMapping(Map<String, ?>
map with URL paths as keys and handler beans (or handler
bean names) as values urlMap)Create a |
| public | SimpleUrlHandlerMapping(Map<String, ?>
map with URL paths as keys and handler beans (or handler
bean names) as values urlMap, int the order value for this order)SimpleUrlHandlerMappingCreate a |
| Modifier and Type | Method and Description |
|---|---|
| public Map | getUrlMap()
Allow |
| public void | initApplicationContext()
Overrides org. Calls the |
| private void | |
| protected void | registerHandlers(Map<String, Object>
a Map with URL paths as keys and handler beans or bean names as values urlMap)Register all handlers specified in the URL map for the corresponding paths. |
| public void | setMappings(Properties
properties with URLs as keys and bean names as values mappings)Map URL paths to handler bean names. |
| public void |
| urlMap | back to summary |
|---|---|
| private final Map<String, Object> urlMap | |
| SimpleUrlHandlerMapping | back to summary |
|---|---|
| public SimpleUrlHandlerMapping() Create a | |
| SimpleUrlHandlerMapping | back to summary |
|---|---|
| public SimpleUrlHandlerMapping(Map<String, ?> urlMap) Create a
| |
| SimpleUrlHandlerMapping | back to summary |
|---|---|
| public SimpleUrlHandlerMapping(Map<String, ?> urlMap, int order) Create a
| |
| getUrlMap | back to summary |
|---|---|
| public Map Allow Useful for specifying entries directly, for example via "urlMap[myKey]". This is particularly useful for adding or overriding entries in child bean definitions. | |
| initApplicationContext | back to summary |
|---|---|
| public void initApplicationContext() throws BeansException Overrides org. Calls the
| |
| logMappings | back to summary |
|---|---|
| private void logMappings() | |
| registerHandlers | back to summary |
|---|---|
| protected void registerHandlers(Map<String, Object> urlMap) throws BeansException Register all handlers specified in the URL map for the corresponding paths.
| |
| setMappings | back to summary |
|---|---|
| public void setMappings(Properties mappings) 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
| |
| setUrlMap | back to summary |
|---|---|
| public void setUrlMap(Map<String, ?> urlMap) 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
| |