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*"). For details on the pattern options, see the PathPattern 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