Save This Page
Home » spring-framework-2.5.5-with-dependencies » org.springframework » web » servlet » handler » [javadoc | source]
org.springframework.web.servlet.handler
public class: SimpleUrlHandlerMapping [javadoc | source]
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:
    HandlerMapping, Ordered, ServletContextAware, ApplicationContextAware

Implementation of the org.springframework.web.servlet.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 org.springframework.util.AntPathMatcher javadoc.

Fields inherited from org.springframework.context.support.ApplicationObjectSupport:
logger
Method from org.springframework.web.servlet.handler.SimpleUrlHandlerMapping Summary:
getUrlMap,   initApplicationContext,   registerHandlers,   setMappings,   setUrlMap
Methods from org.springframework.web.servlet.handler.AbstractUrlHandlerMapping:
buildPathExposingHandler,   exposePathWithinMapping,   getHandlerInternal,   getHandlerMap,   getPathMatcher,   getRootHandler,   lookupHandler,   registerHandler,   registerHandler,   setAlwaysUseFullPath,   setLazyInitHandlers,   setPathMatcher,   setRootHandler,   setUrlDecode,   setUrlPathHelper,   validateHandler
Methods from org.springframework.web.servlet.handler.AbstractHandlerMapping:
adaptInterceptor,   extendInterceptors,   getAdaptedInterceptors,   getDefaultHandler,   getHandler,   getHandlerExecutionChain,   getHandlerInternal,   getOrder,   initApplicationContext,   initInterceptors,   setDefaultHandler,   setInterceptors,   setOrder
Methods from org.springframework.web.context.support.WebApplicationObjectSupport:
getServletContext,   getTempDir,   getWebApplicationContext,   initApplicationContext,   initServletContext,   isContextRequired,   setServletContext
Methods from org.springframework.context.support.ApplicationObjectSupport:
getApplicationContext,   getMessageSourceAccessor,   initApplicationContext,   initApplicationContext,   isContextRequired,   requiredContextClass,   setApplicationContext
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.springframework.web.servlet.handler.SimpleUrlHandlerMapping Detail:
 public Map getUrlMap() 
    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.

 public  void initApplicationContext() throws BeansException 
 protected  void registerHandlers(Map urlMap) throws BeansException 
    Register all handlers specified in the URL map for the corresponding paths.
 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 org.springframework.util.AntPathMatcher javadoc.

 public  void setUrlMap(Map 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 org.springframework.util.AntPathMatcher javadoc.