The following filter is in my prj2 . From this prj2 I check if there is a session that I want to redirect to the prj1 login page that has url /prj1/sessionexpiry . In the following scenario, it is not redirected to the login page and does not throw any exceptions.
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletResponse hsr = (HttpServletResponse) res; HttpServletRequest hreq = (HttpServletRequest) req; HttpSession session = hreq.getSession(false); if (session == null) { hsr.sendRedirect("/prj1/sessionexpiry"); return; } else { chain.doFilter(req, res); } }
Any help would be appreciated
source share