Package org.shredzone.commons.view
Interface ViewInterceptor
-
- All Known Implementing Classes:
EmptyViewInterceptor
@ParametersAreNonnullByDefault public interface ViewInterceptor
Spring beans implementing this interface are allowed to inspect or change the output of view handlers.- Author:
- Richard "Shred" Körber
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanonErrorResponse(ErrorResponseException ex, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)Called when anErrorResponseExceptionoccured.StringonRendering(String template, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)Called when a ViewHandler successfully processed the request and returned a template string that is now to be rendered.voidonRequest(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)Called when a HTTP request was sent to the view service.voidonViewHandlerInvocation(ViewContext context, Object bean, Method method)Called when a ViewHandler is about to be invoked.
-
-
-
Method Detail
-
onRequest
void onRequest(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
Called when a HTTP request was sent to the view service. The request has not yet been processed.- Parameters:
req-HttpServletRequestto be handledresp-HttpServletResponsewith the response
-
onViewHandlerInvocation
void onViewHandlerInvocation(ViewContext context, Object bean, Method method)
Called when a ViewHandler is about to be invoked.- Parameters:
context-ViewContextpassed to the view handlerbean- Spring bean containing the view handlermethod- View handler method that will be invoked
-
onRendering
String onRendering(String template, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
Called when a ViewHandler successfully processed the request and returned a template string that is now to be rendered. The interceptor can change the template name.- Parameters:
template- Template name returned by the view handlerreq-HttpServletRequestthat was handledresp-HttpServletResponsewith the response- Returns:
- a different template name, or
nullfor keeping the original template name
-
onErrorResponse
boolean onErrorResponse(ErrorResponseException ex, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
Called when anErrorResponseExceptionoccured. The interceptor is able to catch the error.- Parameters:
ex-ErrorResponseExceptionthat occuredreq-HttpServletRequestthat led to this errorresp-HttpServletResponsewith the response- Returns:
trueif the interceptor responded to the error. Other interceptors will not be invoked, and theHttpServletResponseis sent back.falseif the error handling shall be continued.
-
-