James Ladd
unread,Jun 26, 2012, 5:35:08 AM6/26/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to dropwiz...@googlegroups.com
Hi All,
I keep getting a 404 error when requesting /favicon.ico from my service.
I have added a filter to forward requests under certain conditions.
However, after the first call of the filter it appears the subsequent call for /favicon.ico
doesnt go through the filter - maybe this is the cause of the 404?
My filter is below.
Suggestions?
- James.
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
String path = request.getPathInfo();
boolean shouldForward = false;
if (!path.startsWith(ASSETS_PATH) && !path.startsWith(API_PATH))
shouldForward = shouldForward(path);
if (shouldForward) {
path = ASSETS_PATH + path;
if (path.endsWith(ROOT_PATH))
path += "index.html";
request.getRequestDispatcher(path).forward(servletRequest, servletResponse);
} else {
filterChain.doFilter(servletRequest, servletResponse);
}
}