org.springframework.web.servlet.handler
Class SimpleUrlHandlerMapping
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
- All Implemented Interfaces:
- ApplicationContextAware, HandlerMapping, Ordered
- public class SimpleUrlHandlerMapping
- extends AbstractUrlHandlerMapping
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 prototype 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*").
- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
DispatcherServlet
,
Properties
Method Summary |
void |
initApplicationContext()
Subclasses can override this for custom initialization behavior. |
void |
setMappings(java.util.Properties mappings)
Set URL to handler bean name mappings from a Properties object. |
void |
setUrlMap(java.util.Map urlMap)
Set a Map with URLs as keys and handler beans as values. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimpleUrlHandlerMapping
public SimpleUrlHandlerMapping()
setUrlMap
public void setUrlMap(java.util.Map urlMap)
- Set a Map with URLs as keys and handler beans as values.
Convenient for population with bean references.
- Parameters:
urlMap
- map with URLs as keys and beans as values
setMappings
public void setMappings(java.util.Properties mappings)
- Set URL to handler bean name mappings from a Properties object.
- Parameters:
mappings
- properties with URL as key and bean name as value
initApplicationContext
public void initApplicationContext()
throws BeansException
- Description copied from class:
ApplicationObjectSupport
- Subclasses can override this for custom initialization behavior.
Gets called by setApplicationContext() after setting the context instance.
Note: Does not get called on reinitialization of the context.
- Overrides:
initApplicationContext
in class ApplicationObjectSupport
- Throws:
BeansException
- if thrown by application context methods
Copyright (C) 2003-2004 The Spring Framework Project.