I've an ErrorFilter which extends the spring GenericFilterBean. I want to show an error page decorated with tiles if some error happens. Is there any way to set a view name from the filter?
<filter>
<filter-name>errorFilter</filter-name>
<filter-class>com.abc.filter.ErrorFilter</filter-class>
<init-param>
<param-name>errorPage</param-name>
<param-value>/jsp/errorpage.jsp</param-value>
</init-param>
</filter>
This is the configuration in web.xml and the doFilter method in errorfilter is the following:
public void doFilter(ServletRequest req, ServletResponse resp,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpReq = (HttpServletRequest) req;
StringBuffer reqUrl = httpReq.getRequestURL();
try {
chain.doFilter(req, resp);
} catch (Exception ex) {
String requestRepresentation = createRequestRepresentation(req);
errorService.handleException(reqUrl.toString(), ex, requestRepresentation);
req.getRequestDispatcher(
getFilterConfig().getInitParameter("errorPage")).forward(req, resp);
} catch (Error er) {
errorService.handleError(reqUrl.toString(), er);
req.getRequestDispatcher(
getFilterConfig().getInitParameter("errorPage")).forward(req, resp);
}
}
the current errorpage is not docorated with tiles... so i want to decorate it with normal header and footer and call that view name from the filer.. is it possible ?