public class WebRequestHandlerInterceptorAdapter extends java.lang.Object implements AsyncHandlerInterceptor
WebRequestInterceptor
,
HandlerInterceptor
Modifier and Type | Field and Description |
---|---|
private WebRequestInterceptor |
requestInterceptor |
Constructor and Description |
---|
WebRequestHandlerInterceptorAdapter(WebRequestInterceptor requestInterceptor)
Create a new WebRequestHandlerInterceptorAdapter for the given WebRequestInterceptor.
|
Modifier and Type | Method and Description |
---|---|
void |
afterCompletion(HttpServletRequest request,
HttpServletResponse response,
java.lang.Object handler,
java.lang.Exception ex)
Callback after completion of request processing, that is, after rendering
the view.
|
void |
afterConcurrentHandlingStarted(HttpServletRequest request,
HttpServletResponse response,
java.lang.Object handler)
Called instead of
postHandle and afterCompletion , when
the a handler is being executed concurrently. |
void |
postHandle(HttpServletRequest request,
HttpServletResponse response,
java.lang.Object handler,
ModelAndView modelAndView)
Intercept the execution of a handler.
|
boolean |
preHandle(HttpServletRequest request,
HttpServletResponse response,
java.lang.Object handler)
Intercept the execution of a handler.
|
private final WebRequestInterceptor requestInterceptor
public WebRequestHandlerInterceptorAdapter(WebRequestInterceptor requestInterceptor)
requestInterceptor
- the WebRequestInterceptor to wrappublic boolean preHandle(HttpServletRequest request, HttpServletResponse response, java.lang.Object handler) throws java.lang.Exception
HandlerInterceptor
DispatcherServlet processes a handler in an execution chain, consisting of any number of interceptors, with the handler itself at the end. With this method, each interceptor can decide to abort the execution chain, typically sending a HTTP error or writing a custom response.
Note: special considerations apply for asynchronous
request processing. For more details see
AsyncHandlerInterceptor
.
preHandle
in interface HandlerInterceptor
request
- current HTTP requestresponse
- current HTTP responsehandler
- chosen handler to execute, for type and/or instance evaluationtrue
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.java.lang.Exception
- in case of errorspublic void postHandle(HttpServletRequest request, HttpServletResponse response, java.lang.Object handler, ModelAndView modelAndView) throws java.lang.Exception
HandlerInterceptor
DispatcherServlet processes a handler in an execution chain, consisting of any number of interceptors, with the handler itself at the end. With this method, each interceptor can post-process an execution, getting applied in inverse order of the execution chain.
Note: special considerations apply for asynchronous
request processing. For more details see
AsyncHandlerInterceptor
.
postHandle
in interface HandlerInterceptor
request
- current HTTP requestresponse
- current HTTP responsehandler
- handler (or HandlerMethod
) that started asynchronous
execution, for type and/or instance examinationmodelAndView
- the ModelAndView
that the handler returned
(can also be null
)java.lang.Exception
- in case of errorspublic void afterCompletion(HttpServletRequest request, HttpServletResponse response, java.lang.Object handler, java.lang.Exception ex) throws java.lang.Exception
HandlerInterceptor
Note: Will only be called if this interceptor's preHandle
method has successfully completed and returned true
!
As with the postHandle
method, the method will be invoked on each
interceptor in the chain in reverse order, so the first interceptor will be
the last to be invoked.
Note: special considerations apply for asynchronous
request processing. For more details see
AsyncHandlerInterceptor
.
afterCompletion
in interface HandlerInterceptor
request
- current HTTP requestresponse
- current HTTP responsehandler
- handler (or HandlerMethod
) that started asynchronous
execution, for type and/or instance examinationex
- exception thrown on handler execution, if anyjava.lang.Exception
- in case of errorspublic void afterConcurrentHandlingStarted(HttpServletRequest request, HttpServletResponse response, java.lang.Object handler)
AsyncHandlerInterceptor
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 up thread-local variables.
afterConcurrentHandlingStarted
in interface AsyncHandlerInterceptor
request
- the current requestresponse
- the current responsehandler
- the handler (or HandlerMethod
) that started async
execution, for type and/or instance examination