public interface AsyncHandlerInterceptor extends HandlerInterceptor
HandlerInterceptor with a callback method invoked during
asynchronous request handling.
When a handler starts asynchronous request handling, the DispatcherServlet
exits without invoking postHandle and afterCompletion, as it
normally does, since the results of request handling (e.g. ModelAndView) are
not available in the current thread and handling is not yet complete.
In such scenarios, the
afterConcurrentHandlingStarted(HttpServletRequest, HttpServletResponse)
method is invoked instead allowing implementations to perform tasks such as
cleaning up thread bound attributes.
When asynchronous handling completes, the request is dispatched to the
container for further processing. At this stage the DispatcherServlet invokes
preHandle, postHandle and afterCompletion as usual.
WebAsyncManager| Modifier and Type | Method and Description |
|---|---|
void |
afterConcurrentHandlingStarted(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Called instead of
postHandle and afterCompletion, when the
a handler is being executed concurrently. |
afterCompletion, postHandle, preHandlevoid afterConcurrentHandlingStarted(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
postHandle and afterCompletion, when the
a handler is being executed concurrently. Implementations may use the provided
request and response but should avoid modifying them in ways that would
conflict with the concurrent execution of the handler. A typical use of
this method would be to clean thread local variables.request - the current requestresponse - the current response