Class WebRequestHandlerInterceptorAdapter
- All Implemented Interfaces:
- AsyncHandlerInterceptor,- HandlerInterceptor
- Since:
- 2.0
- Author:
- Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionWebRequestHandlerInterceptorAdapter(WebRequestInterceptor requestInterceptor) Create a new WebRequestHandlerInterceptorAdapter for the given WebRequestInterceptor.
- 
Method SummaryModifier and TypeMethodDescriptionvoidafterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) Callback after completion of request processing, that is, after rendering the view.voidafterConcurrentHandlingStarted(HttpServletRequest request, HttpServletResponse response, Object handler) Called instead ofpostHandleandafterCompletionwhen the handler is being executed concurrently.voidpostHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) Interception point after successful execution of a handler.booleanpreHandle(HttpServletRequest request, HttpServletResponse response, Object handler) Interception point before the execution of a handler.
- 
Constructor Details- 
WebRequestHandlerInterceptorAdapterCreate a new WebRequestHandlerInterceptorAdapter for the given WebRequestInterceptor.- Parameters:
- requestInterceptor- the WebRequestInterceptor to wrap
 
 
- 
- 
Method Details- 
preHandlepublic boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception Description copied from interface:HandlerInterceptorInterception point before the execution of a handler. Called after HandlerMapping determined an appropriate handler object, but before HandlerAdapter invokes the handler.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 an HTTP error or writing a custom response. Note: special considerations apply for asynchronous request processing. For more details see AsyncHandlerInterceptor.The default implementation returns true.- Specified by:
- preHandlein interface- HandlerInterceptor
- Parameters:
- request- current HTTP request
- response- current HTTP response
- handler- chosen handler to execute, for type and/or instance evaluation
- Returns:
- trueif 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.
- Throws:
- Exception- in case of errors
 
- 
postHandlepublic void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable ModelAndView modelAndView) throws Exception Description copied from interface:HandlerInterceptorInterception point after successful execution of a handler. Called after HandlerAdapter actually invoked the handler, but before the DispatcherServlet renders the view. Can expose additional model objects to the view via the given ModelAndView.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.The default implementation is empty. - Specified by:
- postHandlein interface- HandlerInterceptor
- Parameters:
- request- current HTTP request
- response- current HTTP response
- handler- the handler (or- HandlerMethod) that started asynchronous execution, for type and/or instance examination
- modelAndView- the- ModelAndViewthat the handler returned (can also be- null)
- Throws:
- Exception- in case of errors
 
- 
afterCompletionpublic void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable Exception ex) throws Exception Description copied from interface:HandlerInterceptorCallback after completion of request processing, that is, after rendering the view. Will be called on any outcome of handler execution, thus allows for proper resource cleanup.Note: Will only be called if this interceptor's preHandlemethod has successfully completed and returnedtrue!As with the postHandlemethod, 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.The default implementation is empty. - Specified by:
- afterCompletionin interface- HandlerInterceptor
- Parameters:
- request- current HTTP request
- response- current HTTP response
- handler- the handler (or- HandlerMethod) that started asynchronous execution, for type and/or instance examination
- ex- any exception thrown on handler execution, if any; this does not include exceptions that have been handled through an exception resolver
- Throws:
- Exception- in case of errors
 
- 
afterConcurrentHandlingStartedpublic void afterConcurrentHandlingStarted(HttpServletRequest request, HttpServletResponse response, Object handler) Description copied from interface:AsyncHandlerInterceptorCalled instead ofpostHandleandafterCompletionwhen the 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. - Specified by:
- afterConcurrentHandlingStartedin interface- AsyncHandlerInterceptor
- Parameters:
- request- the current request
- response- the current response
- handler- the handler (or- HandlerMethod) that started async execution, for type and/or instance examination
 
 
-