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 boolean
onErrorResponse(ErrorResponseException ex, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
Called when anErrorResponseException
occured.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.void
onRequest(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
Called when a HTTP request was sent to the view service.void
onViewHandlerInvocation(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
-HttpServletRequest
to be handledresp
-HttpServletResponse
with the response
-
onViewHandlerInvocation
void onViewHandlerInvocation(ViewContext context, Object bean, Method method)
Called when a ViewHandler is about to be invoked.- Parameters:
context
-ViewContext
passed 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
-HttpServletRequest
that was handledresp
-HttpServletResponse
with the response- Returns:
- a different template name, or
null
for keeping the original template name
-
onErrorResponse
boolean onErrorResponse(ErrorResponseException ex, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
Called when anErrorResponseException
occured. The interceptor is able to catch the error.- Parameters:
ex
-ErrorResponseException
that occuredreq
-HttpServletRequest
that led to this errorresp
-HttpServletResponse
with the response- Returns:
true
if the interceptor responded to the error. Other interceptors will not be invoked, and theHttpServletResponse
is sent back.false
if the error handling shall be continued.
-
-