spring-framework / org.springframework.web.servlet.handler / SimpleUrlHandlerMapping / <init>

<init>

SimpleUrlHandlerMapping()

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 "*" pattern 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 on the pattern options, see the org.springframework.util.AntPathMatcher javadoc.

Author
Rod Johnson

Author
Juergen Hoeller

See Also
#setMappings#setUrlMapBeanNameUrlHandlerMapping