public class WebRequestHandlerInterceptorAdapter extends Object implements HandlerInterceptor
NOTE: The WebRequestInterceptor is by default only applied to the Portlet
render phase, which is dealing with preparing and rendering a Portlet view.
The Portlet action phase will only be intercepted with WebRequestInterceptor calls
if the renderPhaseOnly flag is explicitly set to false.
In general, it is recommended to use the Portlet-specific HandlerInterceptor
mechanism for differentiating between action and render interception.
WebRequestInterceptor,
HandlerInterceptor| Constructor and Description |
|---|
WebRequestHandlerInterceptorAdapter(WebRequestInterceptor requestInterceptor)
Create a new WebRequestHandlerInterceptorAdapter for the given WebRequestInterceptor,
applying to the render phase only.
|
WebRequestHandlerInterceptorAdapter(WebRequestInterceptor requestInterceptor,
boolean renderPhaseOnly)
Create a new WebRequestHandlerInterceptorAdapter for the given WebRequestInterceptor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterActionCompletion(ActionRequest request,
ActionResponse response,
Object handler,
Exception ex)
Callback after completion of request processing in the action phase, that is,
after rendering the view.
|
void |
afterEventCompletion(EventRequest request,
EventResponse response,
Object handler,
Exception ex)
Callback after completion of request processing in the action phase, that is,
after rendering the view.
|
void |
afterRenderCompletion(RenderRequest request,
RenderResponse response,
Object handler,
Exception ex)
Callback after completion of request processing, that is, after rendering
the view.
|
void |
afterResourceCompletion(ResourceRequest request,
ResourceResponse response,
Object handler,
Exception ex)
Callback after completion of request processing, that is, after rendering
the view.
|
void |
postHandleRender(RenderRequest request,
RenderResponse response,
Object handler,
ModelAndView modelAndView)
Intercept the execution of a handler in the render phase.
|
void |
postHandleResource(ResourceRequest request,
ResourceResponse response,
Object handler,
ModelAndView modelAndView)
Intercept the execution of a handler in the render phase.
|
boolean |
preHandleAction(ActionRequest request,
ActionResponse response,
Object handler)
Intercept the execution of a handler in the action phase.
|
boolean |
preHandleEvent(EventRequest request,
EventResponse response,
Object handler)
Intercept the execution of a handler in the action phase.
|
boolean |
preHandleRender(RenderRequest request,
RenderResponse response,
Object handler)
Intercept the execution of a handler in the render phase.
|
boolean |
preHandleResource(ResourceRequest request,
ResourceResponse response,
Object handler)
Intercept the execution of a handler in the render phase.
|
public WebRequestHandlerInterceptorAdapter(WebRequestInterceptor requestInterceptor)
requestInterceptor - the WebRequestInterceptor to wrappublic WebRequestHandlerInterceptorAdapter(WebRequestInterceptor requestInterceptor, boolean renderPhaseOnly)
requestInterceptor - the WebRequestInterceptor to wraprenderPhaseOnly - whether to apply to the render phase only (true)
or to the action phase as well (false)public boolean preHandleAction(ActionRequest request, ActionResponse response, Object handler) throws Exception
HandlerInterceptorCalled after a HandlerMapping determines an appropriate handler object
to handle an ActionRequest, but before said HandlerAdapter actually
invokes the handler.
DispatcherPortlet 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 throwing an exception or writing a custom response.
preHandleAction in interface HandlerInterceptorrequest - current portlet action requestresponse - current portlet action 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, DispatcherPortlet
assumes that this interceptor has already dealt with the response itselfException - in case of errorspublic void afterActionCompletion(ActionRequest request, ActionResponse response, Object handler, Exception ex) throws Exception
HandlerInterceptorNote: Will only be called if this interceptor's
HandlerInterceptor.preHandleAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse, Object)
method has successfully completed and returned true!
afterActionCompletion in interface HandlerInterceptorrequest - current portlet action requestresponse - current portlet action responsehandler - chosen handler to execute, for type and/or instance examinationex - exception thrown on handler execution, if any (only included as
additional context information for the case where a handler threw an exception;
request execution may have failed even when this argument is null)Exception - in case of errorspublic boolean preHandleRender(RenderRequest request, RenderResponse response, Object handler) throws Exception
HandlerInterceptorCalled after a HandlerMapping determines an appropriate handler object
to handle a RenderRequest, but before said HandlerAdapter actually
invokes the handler.
DispatcherPortlet 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 throwing an exception or writing a custom response.
preHandleRender in interface HandlerInterceptorrequest - current portlet render requestresponse - current portlet render 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, DispatcherPortlet
assumes that this interceptor has already dealt with the response itselfException - in case of errorspublic void postHandleRender(RenderRequest request, RenderResponse response, Object handler, ModelAndView modelAndView) throws Exception
HandlerInterceptorCalled after a HandlerAdapter actually invoked the handler, but
before the DispatcherPortlet renders the view. Can thus expose
additional model objects to the view via the given ModelAndView.
DispatcherPortlet 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.
postHandleRender in interface HandlerInterceptorrequest - current portlet render requestresponse - current portlet render responsehandler - chosen handler to execute, for type and/or instance examinationmodelAndView - the ModelAndView that the handler returned
(can also be null)Exception - in case of errorspublic void afterRenderCompletion(RenderRequest request, RenderResponse response, Object handler, Exception ex) throws Exception
HandlerInterceptorNote: Will only be called if this interceptor's
HandlerInterceptor.preHandleRender(javax.portlet.RenderRequest, javax.portlet.RenderResponse, Object)
method has successfully completed and returned true!
afterRenderCompletion in interface HandlerInterceptorrequest - current portlet render requestresponse - current portlet render responsehandler - chosen handler to execute, for type and/or instance examinationex - exception thrown on handler execution, if anyException - in case of errorspublic boolean preHandleResource(ResourceRequest request, ResourceResponse response, Object handler) throws Exception
HandlerInterceptorCalled after a HandlerMapping determines an appropriate handler object
to handle a RenderRequest, but before said HandlerAdapter actually
invokes the handler.
DispatcherPortlet 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 throwing an exception or writing a custom response.
preHandleResource in interface HandlerInterceptorrequest - current portlet render requestresponse - current portlet render 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, DispatcherPortlet
assumes that this interceptor has already dealt with the response itselfException - in case of errorspublic void postHandleResource(ResourceRequest request, ResourceResponse response, Object handler, ModelAndView modelAndView) throws Exception
HandlerInterceptorCalled after a HandlerAdapter actually invoked the handler, but
before the DispatcherPortlet renders the view. Can thus expose
additional model objects to the view via the given ModelAndView.
DispatcherPortlet 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.
postHandleResource in interface HandlerInterceptorrequest - current portlet render requestresponse - current portlet render responsehandler - chosen handler to execute, for type and/or instance examinationmodelAndView - the ModelAndView that the handler returned
(can also be null)Exception - in case of errorspublic void afterResourceCompletion(ResourceRequest request, ResourceResponse response, Object handler, Exception ex) throws Exception
HandlerInterceptorNote: Will only be called if this interceptor's
HandlerInterceptor.preHandleRender(javax.portlet.RenderRequest, javax.portlet.RenderResponse, Object)
method has successfully completed and returned true!
afterResourceCompletion in interface HandlerInterceptorrequest - current portlet render requestresponse - current portlet render responsehandler - chosen handler to execute, for type and/or instance examinationex - exception thrown on handler execution, if anyException - in case of errorspublic boolean preHandleEvent(EventRequest request, EventResponse response, Object handler) throws Exception
HandlerInterceptorCalled after a HandlerMapping determines an appropriate handler object
to handle an ActionRequest, but before said HandlerAdapter actually
invokes the handler.
DispatcherPortlet 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 throwing an exception or writing a custom response.
preHandleEvent in interface HandlerInterceptorrequest - current portlet action requestresponse - current portlet action 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, DispatcherPortlet
assumes that this interceptor has already dealt with the response itselfException - in case of errorspublic void afterEventCompletion(EventRequest request, EventResponse response, Object handler, Exception ex) throws Exception
HandlerInterceptorNote: Will only be called if this interceptor's
HandlerInterceptor.preHandleAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse, Object)
method has successfully completed and returned true!
afterEventCompletion in interface HandlerInterceptorrequest - current portlet action requestresponse - current portlet action responsehandler - chosen handler to execute, for type and/or instance examinationex - exception thrown on handler execution, if any (only included as
additional context information for the case where a handler threw an exception;
request execution may have failed even when this argument is null)Exception - in case of errors