public abstract class

AbstractControllerUrlHandlerMapping

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.mvc.support.AbstractControllerUrlHandlerMapping
Known Direct Subclasses

Class Overview

Base class for HandlerMapping implementations that derive URL paths according to conventions for specific controller types.

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
AbstractControllerUrlHandlerMapping()
Public Methods
void setExcludedClasses(Class[] excludedClasses)
Specify controller classes that should be excluded from this mapping.
void setExcludedPackages(String[] excludedPackages)
Specify Java packages that should be excluded from this mapping.
void setIncludeAnnotatedControllers(boolean includeAnnotatedControllers)
Set whether to activate or deactivate detection of annotated controllers.
Protected Methods
abstract String[] buildUrlsForHandler(String beanName, Class beanClass)
Abstract template method to be implemented by subclasses.
String[] determineUrlsForHandler(String beanName)
This implementation delegates to buildUrlsForHandler(String, Class), provided that isEligibleForMapping(String, Class) returns true.
boolean isControllerType(Class beanClass)
Determine whether the given bean class indicates a controller type that is supported by this mapping strategy.
boolean isEligibleForMapping(String beanName, Class beanClass)
Determine whether the specified controller is excluded from this mapping.
boolean isMultiActionControllerType(Class beanClass)
Determine whether the given bean class indicates a controller type that dispatches to multiple action methods.
[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 AbstractControllerUrlHandlerMapping ()

Public Methods

public void setExcludedClasses (Class[] excludedClasses)

Specify controller classes that should be excluded from this mapping. Any such classes will simply be ignored by this HandlerMapping.

public void setExcludedPackages (String[] excludedPackages)

Specify Java packages that should be excluded from this mapping. Any classes in such a package (or any of its subpackages) will be ignored by this HandlerMapping.

Default is to exclude the entire "org.springframework.web.servlet.mvc" package, including its subpackages, since none of Spring's out-of-the-box Controller implementations is a reasonable candidate for this mapping strategy. Such controllers are typically handled by a separate HandlerMapping, e.g. a BeanNameUrlHandlerMapping, alongside this ControllerClassNameHandlerMapping for application controllers.

public void setIncludeAnnotatedControllers (boolean includeAnnotatedControllers)

Set whether to activate or deactivate detection of annotated controllers.

Protected Methods

protected abstract String[] buildUrlsForHandler (String beanName, Class beanClass)

Abstract template method to be implemented by subclasses.

Parameters
beanName the name of the bean
beanClass the type of the bean
Returns
  • the URLs determined for the bean

protected String[] determineUrlsForHandler (String beanName)

This implementation delegates to buildUrlsForHandler(String, Class), provided that isEligibleForMapping(String, Class) returns true.

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

protected boolean isControllerType (Class beanClass)

Determine whether the given bean class indicates a controller type that is supported by this mapping strategy.

Parameters
beanClass the class to introspect

protected boolean isEligibleForMapping (String beanName, Class beanClass)

Determine whether the specified controller is excluded from this mapping.

Parameters
beanName the name of the controller bean
beanClass the concrete class of the controller bean
Returns
  • whether the specified class is excluded

protected boolean isMultiActionControllerType (Class beanClass)

Determine whether the given bean class indicates a controller type that dispatches to multiple action methods.

Parameters
beanClass the class to introspect