|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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 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, 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 syntax details, see the PathMatcher class.
DispatcherServlet
,
PathMatcher
,
Properties
Field Summary |
Fields inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping |
logger |
Constructor Summary | |
SimpleUrlHandlerMapping()
|
Method Summary | |
void |
initApplicationContext()
Subclasses can override this for custom initialization behavior. |
void |
setMappings(Properties mappings)
Map URL paths to handler bean names. |
void |
setUrlMap(Map urlMap)
Set a Map with URL paths as keys and handler beans as values. |
Methods inherited from class org.springframework.web.servlet.handler.AbstractUrlHandlerMapping |
getHandlerInternal, lookupHandler, registerHandler, setAlwaysUseFullPath, setLazyInitHandlers, setUrlDecode, setUrlPathHelper |
Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping |
getDefaultHandler, getHandler, getOrder, setDefaultHandler, setInterceptors, setOrder |
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport |
getServletContext, getTempDir, getWebApplicationContext, isContextRequired |
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport |
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SimpleUrlHandlerMapping()
Method Detail |
public void setUrlMap(Map urlMap)
Supports direct URL matches and Ant-style pattern matches. For syntax details, see the PathMatcher class.
urlMap
- map with URLs as keys and beans as valuesPathMatcher
public void setMappings(Properties mappings)
Supports direct URL matches and Ant-style pattern matches. For syntax details, see the PathMatcher class.
mappings
- properties with URLs as keys and bean names as valuesPathMatcher
public void initApplicationContext() throws BeansException
ApplicationObjectSupport
setApplicationContext
after setting the context instance.
Note: Does not get called on reinitialization of the context but rather just on first initialization of this object's context reference.
initApplicationContext
in class ApplicationObjectSupport
BeansException
- if thrown by ApplicationContext methodsApplicationObjectSupport.setApplicationContext(org.springframework.context.ApplicationContext)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |