public class

BeanNameUrlHandlerMapping

extends AbstractDetectingUrlHandlerMapping
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.AbstractDetectingUrlHandlerMapping
             ↳ org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping

Class Overview

Implementation of the HandlerMapping interface that map from URLs to beans with names that start with a slash ("/"), similar to how Struts maps URLs to action names.

This is the default implementation used by the DispatcherServlet, along with DefaultAnnotationHandlerMapping (on Java 5 and higher). Alternatively, SimpleUrlHandlerMapping allows for customizing a handler mapping declaratively.

The mapping is from URL to bean name. Thus an incoming URL "/foo" would map to a handler named "/foo", or to "/foo /foo2" in case of multiple mappings to a single handler. Note: In XML definitions, you'll need to use an alias name="/foo" in the bean definition, as the XML id may not contain slashes.

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 AntPathMatcher javadoc.

Summary

[Expand]
Inherited Constants
From interface org.springframework.core.Ordered
[Expand]
Inherited Fields
From class org.springframework.context.support.ApplicationObjectSupport
From interface org.springframework.web.servlet.HandlerMapping
Public Constructors
BeanNameUrlHandlerMapping()
Protected Methods
String[] determineUrlsForHandler(String beanName)
Checks name and aliases of the given bean for URLs, starting with "/".
[Expand]
Inherited Methods
From class org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping
From class org.springframework.web.servlet.handler.AbstractUrlHandlerMapping
From class org.springframework.web.servlet.handler.AbstractHandlerMapping
From class org.springframework.web.context.support.WebApplicationObjectSupport
From class org.springframework.context.support.ApplicationObjectSupport
From class java.lang.Object
From interface org.springframework.context.ApplicationContextAware
From interface org.springframework.core.Ordered
From interface org.springframework.web.context.ServletContextAware
From interface org.springframework.web.servlet.HandlerMapping

Public Constructors

public BeanNameUrlHandlerMapping ()

Protected Methods

protected String[] determineUrlsForHandler (String beanName)

Checks name and aliases of the given bean for URLs, starting with "/".

Parameters
beanName the name of the candidate bean
Returns
  • the URLs determined for the bean, or null or an empty array if none