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

public Class HandlerExecutionChain

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Arrays, .Collections, .List, jakarta.servlet.http.HttpServletRequest, .HttpServletResponse, org.apache.commons.logging.Log, .LogFactory, org.springframework.lang.Nullable, org.springframework.util.CollectionUtils

Handler execution chain, consisting of handler object and any handler interceptors. Returned by HandlerMapping's HandlerMapping#getHandler method.
Author
Juergen Hoeller
Since
20.06.2003
See Also
HandlerInterceptor

Field Summary

Modifier and TypeField and Description
private final Object
private int
private final List<HandlerInterceptor>
private static final Log

Constructor Summary

AccessConstructor and Description
public
HandlerExecutionChain(Object
the handler object to execute
handler
)

Create a new HandlerExecutionChain.

public
HandlerExecutionChain(Object
the handler object to execute
handler
,
HandlerInterceptor...
the array of interceptors to apply (in the given order) before the handler itself executes
interceptors
)

Create a new HandlerExecutionChain.

public
HandlerExecutionChain(Object
the handler object to execute
handler
,
List<HandlerInterceptor>
the list of interceptors to apply (in the given order) before the handler itself executes
interceptorList
)

Create a new HandlerExecutionChain.

Method Summary

Modifier and TypeMethod and Description
public void
addInterceptor(HandlerInterceptor interceptor)

Add the given interceptor to the end of this chain.

public void
addInterceptor(int index, HandlerInterceptor interceptor)

Add the given interceptor at the specified index of this chain.

public void
addInterceptors(HandlerInterceptor... interceptors)

Add the given interceptors to the end of this chain.

pack-priv void
applyAfterConcurrentHandlingStarted(HttpServletRequest request, HttpServletResponse response)

Apply afterConcurrentHandlerStarted callback on mapped AsyncHandlerInterceptors.

pack-priv void
applyPostHandle(HttpServletRequest request, HttpServletResponse response, ModelAndView mv)

Apply postHandle methods of registered interceptors.

pack-priv boolean

Returns:

true if the execution chain should proceed with the next interceptor or the handler itself. Else, DispatcherServlet assumes that this interceptor has already dealt with the response itself.
applyPreHandle
(HttpServletRequest request, HttpServletResponse response)

Apply preHandle methods of registered interceptors.

public Object
getHandler()

Return the handler object to execute.

public List<HandlerInterceptor>

Returns:

the list of HandlerInterceptors instances (potentially empty)
getInterceptorList
()

Return the list of interceptors to apply (in the given order).

public HandlerInterceptor[]

Returns:

the array of HandlerInterceptors instances (may be null)
getInterceptors
()

Return the array of interceptors to apply (in the given order).

public String
toString()

Overrides java.lang.Object.toString.

Delegates to the handler's toString() implementation.

pack-priv void
triggerAfterCompletion(HttpServletRequest request, HttpServletResponse response, Exception ex)

Trigger afterCompletion callbacks on the mapped HandlerInterceptors.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

handlerback to summary
private final Object handler
interceptorIndexback to summary
private int interceptorIndex
interceptorListback to summary
private final List<HandlerInterceptor> interceptorList
loggerback to summary
private static final Log logger

Constructor Detail

HandlerExecutionChainback to summary
public HandlerExecutionChain(Object handler)

Create a new HandlerExecutionChain.

Parameters
handler:Object

the handler object to execute

HandlerExecutionChainback to summary
public HandlerExecutionChain(Object handler, HandlerInterceptor... interceptors)

Create a new HandlerExecutionChain.

Parameters
handler:Object

the handler object to execute

interceptors:HandlerInterceptor[]

the array of interceptors to apply (in the given order) before the handler itself executes

HandlerExecutionChainback to summary
public HandlerExecutionChain(Object handler, List<HandlerInterceptor> interceptorList)

Create a new HandlerExecutionChain.

Parameters
handler:Object

the handler object to execute

interceptorList:List<HandlerInterceptor>

the list of interceptors to apply (in the given order) before the handler itself executes

Since
5.3

Method Detail

addInterceptorback to summary
public void addInterceptor(HandlerInterceptor interceptor)

Add the given interceptor to the end of this chain.

addInterceptorback to summary
public void addInterceptor(int index, HandlerInterceptor interceptor)

Add the given interceptor at the specified index of this chain.

Since
5.2
addInterceptorsback to summary
public void addInterceptors(HandlerInterceptor... interceptors)

Add the given interceptors to the end of this chain.

applyAfterConcurrentHandlingStartedback to summary
pack-priv void applyAfterConcurrentHandlingStarted(HttpServletRequest request, HttpServletResponse response)

Apply afterConcurrentHandlerStarted callback on mapped AsyncHandlerInterceptors.

applyPostHandleback to summary
pack-priv void applyPostHandle(HttpServletRequest request, HttpServletResponse response, ModelAndView mv) throws Exception

Apply postHandle methods of registered interceptors.

applyPreHandleback to summary
pack-priv boolean applyPreHandle(HttpServletRequest request, HttpServletResponse response) throws Exception

Apply preHandle methods of registered interceptors.

Returns:boolean

true if the execution chain should proceed with the next interceptor or the handler itself. Else, DispatcherServlet assumes that this interceptor has already dealt with the response itself.

getHandlerback to summary
public Object getHandler()

Return the handler object to execute.

getInterceptorListback to summary
public List<HandlerInterceptor> getInterceptorList()

Return the list of interceptors to apply (in the given order).

Returns:List<HandlerInterceptor>

the list of HandlerInterceptors instances (potentially empty)

Since
5.3
getInterceptorsback to summary
public HandlerInterceptor[] getInterceptors()

Return the array of interceptors to apply (in the given order).

Returns:HandlerInterceptor[]

the array of HandlerInterceptors instances (may be null)

Annotations
@Nullable
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Delegates to the handler's toString() implementation.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object

Annotations
@Override
triggerAfterCompletionback to summary
pack-priv void triggerAfterCompletion(HttpServletRequest request, HttpServletResponse response, Exception ex)

Trigger afterCompletion callbacks on the mapped HandlerInterceptors. Will just invoke afterCompletion for all interceptors whose preHandle invocation has successfully completed and returned true.