Single Page Filter Exception

Asked

Viewed 172 times

0

I have a filter @Webfilter("/*") that blocks everything, however, I would like you to have some exception pages...

A page (or one I chose) is not blocked

Has as?

@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, so

  • Has, making nail in your filter (another example here). If the doubt is "@WebFilter has an attribute to exclude certain URL patterns?" or something like, (not yet) :)

  • Post your filter code. So it is easier to show what can be changed on it to allow the exceptions you want.

  • already.. but I have no idea how to do it, I’m studying @Renan’s suggestion

  • postei.. so I took all my Rvlets, but wanted to put all except for an ex; log in

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.