Top Description Fields Constructors Methods
org.springframework.web.servlet.handler

public abstract Class AbstractDetectingUrlHandlerMapping

extends AbstractUrlHandlerMapping
Class Inheritance
Known Direct Subclasses
org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping
Imports
org.springframework.beans.BeansException, org.springframework.beans.factory.BeanFactoryUtils, org.springframework.context.ApplicationContext, .ApplicationContextException, org.springframework.util.ObjectUtils

Abstract implementation of the org.springframework.web.servlet.HandlerMapping interface, detecting URL mappings for handler beans through introspection of all defined beans in the application context.
Author
Juergen Hoeller
Since
2.5
See Also
determineUrlsForHandler

Field Summary

Modifier and TypeField and Description
private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
detectHandlers()

Register all handlers found in the current ApplicationContext.

protected abstract String[]

Returns:

the URLs determined for the bean, or an empty array if none
determineUrlsForHandler
(String
the name of the candidate bean
beanName
)

Determine the URLs for the given handler bean.

public void
public void
setDetectHandlersInAncestorContexts(boolean detectHandlersInAncestorContexts)

Set whether to detect handler beans in ancestor ApplicationContexts.

Inherited from org.springframework.web.servlet.handler.AbstractUrlHandlerMapping:
buildPathExposingHandlerexposePathWithinMappingexposeUriTemplateVariablesgetHandlerInternalgetHandlerMapgetPathPatternHandlerMapgetRootHandlerlookupHandlerlookupHandlermatchregisterHandlerregisterHandlersetLazyInitHandlerssetPatternParsersetRootHandlersetUseTrailingSlashMatchsupportsTypeLevelMappingsuseTrailingSlashMatchvalidateHandler

Field Detail

detectHandlersInAncestorContextsback to summary
private boolean detectHandlersInAncestorContexts

Constructor Detail

AbstractDetectingUrlHandlerMappingback to summary
public AbstractDetectingUrlHandlerMapping()

Method Detail

detectHandlersback to summary
protected void detectHandlers() throws BeansException

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.

Exceptions
BeansException:
if the handler couldn't be registered
See Also
determineUrlsForHandler(String)
determineUrlsForHandlerback to summary
protected abstract String[] determineUrlsForHandler(String beanName)

Determine the URLs for the given handler bean.

Parameters
beanName:String

the name of the candidate bean

Returns:String[]

the URLs determined for the bean, or an empty array if none

initApplicationContextback to summary
public void initApplicationContext() throws ApplicationContextException

Overrides org.springframework.web.servlet.handler.AbstractHandlerMapping.initApplicationContext.

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

Annotations
@Override
Exceptions
ApplicationContextException:

Doc from org.springframework.context.support.ApplicationObjectSupport.initApplicationContext.

in case of initialization errors

setDetectHandlersInAncestorContextsback to summary
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.