I have a filter @WebFilter ("/ *") that blocks everything, however, I would like it to have exception of a few pages ...
A page (or one I chose) was not blocked
What is it like?
@WebFilter(urlPatterns = {"/retiro","/valor","/pessoa","/gasto","/desistente","/total","/usuario","/imprimir","/pagamento"})
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = ((HttpServletRequest)request);
HttpServletResponse res = ((HttpServletResponse)response);
HttpSession session = req.getSession(false);
// String usuario = String.valueOf(session.getAttribute("login"));
if(session.getAttribute("login") != null){
//((HttpServletRequest)request).getRequestDispatcher("/index").forward(req, res);
// res.sendRedirect("index");
chain.doFilter(request, response);
}else{
((HttpServletRequest)request).getRequestDispatcher("/index").forward(req, res);
// res.sendRedirect("index");
}
//chain.doFilter(request, response);
}
I'm currently using it, so