public abstract class

AbstractDetectingUrlHandlerMapping

extends AbstractUrlHandlerMapping
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
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Abstract implementation of the HandlerMapping interface, detecting URL mappings for handler beans through introspection of all defined beans in the application context.

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
AbstractDetectingUrlHandlerMapping()
Public Methods
void initApplicationContext()
Calls the detectHandlers() method in addition to the superclass's initialization.
void setDetectHandlersInAncestorContexts(boolean detectHandlersInAncestorContexts)
Set whether to detect handler beans in ancestor ApplicationContexts.
Protected Methods
void detectHandlers()
Register all handlers found in the current ApplicationContext.
abstract String[] determineUrlsForHandler(String beanName)
Determine the URLs for the given handler bean.
[Expand]
Inherited Methods
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 AbstractDetectingUrlHandlerMapping ()

Public Methods

public void initApplicationContext ()

Calls the detectHandlers() method in addition to the superclass's initialization.

public void setDetectHandlersInAncestorContexts (boolean detectHandlersInAncestorContexts)

Set whether to detect handler beans in ancestor ApplicationContexts.

Default is "false": Only handler beans in the current ApplicationContext will be detected, i.e. only in the context that this HandlerMapping itself is defined in (typically the current DispatcherServlet's context).

Switch this flag on to detect handler beans in ancestor contexts (typically the Spring root WebApplicationContext) as well.

Protected Methods

protected void detectHandlers ()

Register all handlers found in the current ApplicationContext.

The actual URL determination for a handler is up to the concrete determineUrlsForHandler(String) implementation. A bean for which no such URLs could be determined is simply not considered a handler.

Throws
BeansException if the handler couldn't be registered

protected abstract String[] determineUrlsForHandler (String beanName)

Determine the URLs for the given handler bean.

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