类 WebRequestHandlerInterceptorAdapter
- java.lang.Object
- org.springframework.web.portlet.handler.WebRequestHandlerInterceptorAdapter
- 所有已实现的接口:
HandlerInterceptor
public class WebRequestHandlerInterceptorAdapter extends Object implements HandlerInterceptor
Adapter that implements the Portlet HandlerInterceptor interface and wraps an underlying WebRequestInterceptor.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 tofalse
. In general, it is recommended to use the Portlet-specific HandlerInterceptor mechanism for differentiating between action and render interception.- 从以下版本开始:
- 2.0
- 作者:
- Juergen Hoeller
- 另请参阅:
WebRequestInterceptor
,HandlerInterceptor
构造器概要
构造器 构造器 说明 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.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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.
构造器详细资料
WebRequestHandlerInterceptorAdapter
public WebRequestHandlerInterceptorAdapter(WebRequestInterceptor requestInterceptor)
Create a new WebRequestHandlerInterceptorAdapter for the given WebRequestInterceptor, applying to the render phase only.- 参数:
requestInterceptor
- the WebRequestInterceptor to wrap
WebRequestHandlerInterceptorAdapter
public WebRequestHandlerInterceptorAdapter(WebRequestInterceptor requestInterceptor, boolean renderPhaseOnly)
Create a new WebRequestHandlerInterceptorAdapter for the given WebRequestInterceptor.- 参数:
requestInterceptor
- the WebRequestInterceptor to wraprenderPhaseOnly
- whether to apply to the render phase only (true
) or to the action phase as well (false
)
方法详细资料
preHandleAction
public boolean preHandleAction(ActionRequest request, ActionResponse response, Object handler) throws Exception
从接口复制的说明:HandlerInterceptor
Intercept the execution of a handler in the action phase.Called 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
在接口中HandlerInterceptor
- 参数:
request
- current portlet action requestresponse
- current portlet action responsehandler
- chosen handler to execute, for type and/or instance evaluation- 返回:
true
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 itself- 抛出:
Exception
- in case of errors
afterActionCompletion
public void afterActionCompletion(ActionRequest request, ActionResponse response, Object handler, Exception ex) throws Exception
从接口复制的说明:HandlerInterceptor
Callback after completion of request processing in the action phase, that is, after rendering the view. Will be called on any outcome of handler execution, thus allowing for proper resource cleanup.Note: Will only be called if this interceptor's
HandlerInterceptor.preHandleAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse, Object)
method has successfully completed and returnedtrue
!- 指定者:
afterActionCompletion
在接口中HandlerInterceptor
- 参数:
request
- 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 isnull
)- 抛出:
Exception
- in case of errors
preHandleRender
public boolean preHandleRender(RenderRequest request, RenderResponse response, Object handler) throws Exception
从接口复制的说明:HandlerInterceptor
Intercept the execution of a handler in the render phase.Called 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
在接口中HandlerInterceptor
- 参数:
request
- current portlet render requestresponse
- current portlet render responsehandler
- chosen handler to execute, for type and/or instance evaluation- 返回:
true
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 itself- 抛出:
Exception
- in case of errors
postHandleRender
public void postHandleRender(RenderRequest request, RenderResponse response, Object handler, ModelAndView modelAndView) throws Exception
从接口复制的说明:HandlerInterceptor
Intercept the execution of a handler in the render phase.Called after a
HandlerAdapter
actually invoked the handler, but before theDispatcherPortlet
renders the view. Can thus expose additional model objects to the view via the givenModelAndView
.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
在接口中HandlerInterceptor
- 参数:
request
- current portlet render requestresponse
- current portlet render responsehandler
- chosen handler to execute, for type and/or instance examinationmodelAndView
- theModelAndView
that the handler returned (can also benull
)- 抛出:
Exception
- in case of errors
afterRenderCompletion
public void afterRenderCompletion(RenderRequest request, RenderResponse response, Object handler, Exception ex) throws Exception
从接口复制的说明:HandlerInterceptor
Callback after completion of request processing, that is, after rendering the view. Will be called on any outcome of handler execution, thus allowing for proper resource cleanup.Note: Will only be called if this interceptor's
HandlerInterceptor.preHandleRender(javax.portlet.RenderRequest, javax.portlet.RenderResponse, Object)
method has successfully completed and returnedtrue
!- 指定者:
afterRenderCompletion
在接口中HandlerInterceptor
- 参数:
request
- current portlet render requestresponse
- current portlet render responsehandler
- chosen handler to execute, for type and/or instance examinationex
- exception thrown on handler execution, if any- 抛出:
Exception
- in case of errors
preHandleResource
public boolean preHandleResource(ResourceRequest request, ResourceResponse response, Object handler) throws Exception
从接口复制的说明:HandlerInterceptor
Intercept the execution of a handler in the render phase.Called 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
在接口中HandlerInterceptor
- 参数:
request
- current portlet render requestresponse
- current portlet render responsehandler
- chosen handler to execute, for type and/or instance evaluation- 返回:
true
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 itself- 抛出:
Exception
- in case of errors
postHandleResource
public void postHandleResource(ResourceRequest request, ResourceResponse response, Object handler, ModelAndView modelAndView) throws Exception
从接口复制的说明:HandlerInterceptor
Intercept the execution of a handler in the render phase.Called after a
HandlerAdapter
actually invoked the handler, but before theDispatcherPortlet
renders the view. Can thus expose additional model objects to the view via the givenModelAndView
.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
在接口中HandlerInterceptor
- 参数:
request
- current portlet render requestresponse
- current portlet render responsehandler
- chosen handler to execute, for type and/or instance examinationmodelAndView
- theModelAndView
that the handler returned (can also benull
)- 抛出:
Exception
- in case of errors
afterResourceCompletion
public void afterResourceCompletion(ResourceRequest request, ResourceResponse response, Object handler, Exception ex) throws Exception
从接口复制的说明:HandlerInterceptor
Callback after completion of request processing, that is, after rendering the view. Will be called on any outcome of handler execution, thus allowing for proper resource cleanup.Note: Will only be called if this interceptor's
HandlerInterceptor.preHandleRender(javax.portlet.RenderRequest, javax.portlet.RenderResponse, Object)
method has successfully completed and returnedtrue
!- 指定者:
afterResourceCompletion
在接口中HandlerInterceptor
- 参数:
request
- current portlet render requestresponse
- current portlet render responsehandler
- chosen handler to execute, for type and/or instance examinationex
- exception thrown on handler execution, if any- 抛出:
Exception
- in case of errors
preHandleEvent
public boolean preHandleEvent(EventRequest request, EventResponse response, Object handler) throws Exception
从接口复制的说明:HandlerInterceptor
Intercept the execution of a handler in the action phase.Called 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
在接口中HandlerInterceptor
- 参数:
request
- current portlet action requestresponse
- current portlet action responsehandler
- chosen handler to execute, for type and/or instance evaluation- 返回:
true
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 itself- 抛出:
Exception
- in case of errors
afterEventCompletion
public void afterEventCompletion(EventRequest request, EventResponse response, Object handler, Exception ex) throws Exception
从接口复制的说明:HandlerInterceptor
Callback after completion of request processing in the action phase, that is, after rendering the view. Will be called on any outcome of handler execution, thus allowing for proper resource cleanup.Note: Will only be called if this interceptor's
HandlerInterceptor.preHandleAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse, Object)
method has successfully completed and returnedtrue
!- 指定者:
afterEventCompletion
在接口中HandlerInterceptor
- 参数:
request
- 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 isnull
)- 抛出:
Exception
- in case of errors