In the filter, the response is ServletResponse , not HttpServletResponse . Hand over the cast to the HttpServletResponse .
HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.sendRedirect("/login.jsp");
If the context path is used:
httpResponse.sendRedirect(req.getContextPath() + "/login.jsp");
Also remember to call return; in the end.
Dead Programmer Mar 15 2018-11-11T00: 00Z
source share