As this solved your problem, posting it as an answer.
Firstly, you need to ensure that you're either passing the request along the application filter chain, or you're redirecting it:
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain filterChain) throws IOException, ServletException {
Boolean filtered = false;
System.out.println("request intercepted");
if (!filtered) {
filtered = true;
((HttpServletResponse) response).sendRedirect("/Servlet1");
return;
}
filterChain.doFilter(request, response);
}
Then you need to ensure that the filter knows when an incoming request has already been redirected, so that it doesn't redirect it again:
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain filterChain) throws IOException, ServletException {
Boolean filtered = false;
System.out.println("request intercepted");
if (request.getAttribute("filtered") != null) {
filtered = (Boolean) request.getAttribute("filtered");
}
if (!filtered) {
request.setAttribute("filtered", Boolean.TRUE);
((HttpServletResponse) response).sendRedirect("/Servlet1");
return;
}
filterChain.doFilter(request, response);
}