Class BeanNameUrlHandlerMapping

All Implemented Interfaces:
Aware, BeanNameAware, ApplicationContextAware, Ordered, ServletContextAware, MatchableHandlerMapping, HandlerMapping

public class BeanNameUrlHandlerMapping extends AbstractDetectingUrlHandlerMapping
Implementation of the HandlerMapping interface that maps 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 RequestMappingHandlerMapping. 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.

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.

Author:
Rod Johnson, Juergen Hoeller
See Also:
  • Constructor Details

    • BeanNameUrlHandlerMapping

      public BeanNameUrlHandlerMapping()
  • Method Details

    • determineUrlsForHandler

      protected String[] determineUrlsForHandler(String beanName)
      Checks name and aliases of the given bean for URLs, starting with "/".
      Specified by:
      determineUrlsForHandler in class AbstractDetectingUrlHandlerMapping
      Parameters:
      beanName - the name of the candidate bean
      Returns:
      the URLs determined for the bean, or an empty array if none