Hi, I am trying to implement a filter for all my files excluding login.jsp. I understand that filter mapping cannot exclude certain files. What I need to do is to create another filter to map just the login.jsp. How do I create another file that with url pattern /login.jsp and without SessionFilter being processed after it? Here is part of my code for session filter for all files.
public class SessionFilter implements Filter{
RequestDispatcher rd = null;
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
throws IOException, ServletException{
HttpServletRequest request = (HttpServletRequest)request;
HttpSession session = request.getSession();
// New Session so forward to login.jsp
if (session.isNew()){
rd = request.getRequestDispatcher("login.jsp");
rd.forward(request, response);
}
// Not a new session so continue to the requested resource
else{
filterChain.doFilter(request, response);
}
}