Servlet Filter going in infinite loop when FORWARD used in mapping in JSF

前端 未结 2 997
囚心锁ツ
囚心锁ツ 2021-01-23 18:18

I have a filter defined in web.xml like following:-


    AuthenticationFilter
    

        
2条回答
  •  南笙
    南笙 (楼主)
    2021-01-23 18:39

    Theory:

    1. Topics.jsp requires validation, so a redirect is made to LogIn.jsf.

    2. LogIn.jsf is served by the FacesServlet. But the page that is containg the faces is really a jsp page. So the servlet mades a forward to the LogIn.jsp (the page that builds the component tree).

    3. In your filter, the path is LogIn.jsp and you don't validate a request for LogIn.jsp so you ask for authentication and a redirect to LogIn.jsf is made again. Go to step 2.

    So if you remove , the forwarding of the FacesServlet from LogIn.jsf to LogIn.jsp doesn't enter in the loop.

    Quick solution: Add LogIn.jsp to the list of path infos in your if statement.

提交回复
热议问题