java.lang.Object | |||
↳ | org.springframework.context.support.ApplicationObjectSupport | ||
↳ | org.springframework.web.context.support.WebApplicationObjectSupport | ||
↳ | org.springframework.web.servlet.handler.AbstractHandlerMapping |
Known Direct Subclasses |
Known Indirect Subclasses |
Abstract base class for HandlerMapping
implementations. Supports ordering, a default handler, and handler interceptors.
Note: This base class does not support exposure of the
PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE
. Support for this attribute
is up to concrete subclasses, typically based on request URL mappings.
[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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return the default handler for this handler mapping,
or
null if none. | |||||||||||
Look up a handler for the given request, falling back to the default
handler if no specific one is found.
| |||||||||||
Return the order value of this object, with a
higher value meaning greater in terms of sorting.
| |||||||||||
Set the default handler for this handler mapping.
| |||||||||||
Set the interceptors to apply for all handlers mapped by this handler mapping.
| |||||||||||
Specify the order value for this HandlerMapping bean.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adapt the given interceptor object to the HandlerInterceptor interface.
| |||||||||||
Extension hook that subclasses can override to register additional interceptors,
given the configured interceptors (see
setInterceptors(Object[]) ). | |||||||||||
Return the adapted interceptors as HandlerInterceptor array.
| |||||||||||
Build a HandlerExecutionChain for the given handler, including applicable interceptors.
| |||||||||||
Look up a handler for the given request, returning
null if no
specific one is found. | |||||||||||
Initializes the interceptors.
| |||||||||||
Initialize the specified interceptors, adapting them where necessary.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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
|
Return the default handler for this handler mapping,
or null
if none.
Look up a handler for the given request, falling back to the default handler if no specific one is found.
request | current HTTP request |
---|
Exception |
---|
Return the order value of this object, with a higher value meaning greater in terms of sorting.
Normally starting with 0, with Integer.MAX_VALUE
indicating the greatest value. Same order values will result
in arbitrary positions for the affected objects.
Higher values can be interpreted as lower priority. As a consequence, the object with the lowest value has highest priority (somewhat analogous to Servlet "load-on-startup" values).
Set the default handler for this handler mapping. This handler will be returned if no specific mapping was found.
Default is null
, indicating no default handler.
Set the interceptors to apply for all handlers mapped by this handler mapping.
Supported interceptor types are HandlerInterceptor and WebRequestInterceptor.
interceptors | array of handler interceptors, or null if none |
---|
Specify the order value for this HandlerMapping bean.
Default value is Integer.MAX_VALUE
, meaning that it's non-ordered.
Adapt the given interceptor object to the HandlerInterceptor interface.
Supported interceptor types are HandlerInterceptor and WebRequestInterceptor. Each given WebRequestInterceptor will be wrapped in a WebRequestHandlerInterceptorAdapter. Can be overridden in subclasses.
interceptor | the specified interceptor object |
---|
Extension hook that subclasses can override to register additional interceptors,
given the configured interceptors (see setInterceptors(Object[])
).
Will be invoked before initInterceptors()
adapts the specified
interceptors into HandlerInterceptor
instances.
The default implementation is empty.
interceptors | the configured interceptor List (never null ),
allowing to add further interceptors before as well as after the existing
interceptors
|
---|
Return the adapted interceptors as HandlerInterceptor array.
null
if none
Build a HandlerExecutionChain for the given handler, including applicable interceptors.
The default implementation simply builds a standard HandlerExecutionChain with the given handler and this handler mapping's common interceptors. Subclasses may override this in order to extend/rearrange the list of interceptors.
NOTE: The passed-in handler object may be a raw handler or a pre-built HandlerExecutionChain. This method should handle those two cases explicitly, either building a new HandlerExecutionChain or extending the existing chain.
For simply adding an interceptor, consider calling super.getHandlerExecutionChain
and invoking addInterceptor(HandlerInterceptor)
on the returned chain object.
handler | the resolved handler instance (never null ) |
---|---|
request | current HTTP request |
null
)Look up a handler for the given request, returning null
if no
specific one is found. This method is called by getHandler(HttpServletRequest)
;
a null
return value will lead to the default handler, if one is set.
Note: This method may also return a pre-built HandlerExecutionChain
,
combining a handler object with dynamically determined interceptors.
Statically specified interceptors will get merged into such an existing chain.
request | current HTTP request |
---|
null
if none foundException | if there is an internal error |
---|
Initialize the specified interceptors, adapting them where necessary.