4 Replies Latest reply on Feb 11, 2008 11:44 AM by Mauro T

    Richfaces and Servlet Filters

    Mauro T Newbie

      I create a dummy filter and I realize that filter is invoked 3 times. Why ?

      web.xml

      <filter>
       <filter-name>testFilter</filter-name>
       <filter-class>com.mypack.TestFilter</filter-class>
      </filter>
      <filter-mapping>
       <filter-name>testFilter</filter-name>
       <url-pattern>/*</url-pattern>
      </filter-mapping>
      


      TestFilter.java
      public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
       System.out.println("THAT'S IT");
       HttpServletRequest request = (HttpServletRequest) servletRequest;
       System.out.println(request.getRequestURI());
      }
      


      And the output when a request
      THAT'S IT
      /MYTEST/mytest.jsf
      THAT'S IT
      /MYTEST/a4j_3_1_4.GAcss/table.xcss/DATB/eAELvfwiAQAGAQJx.jsf
      THAT'S IT
      /MYTEST/a4j_3_1_4.GAorg.richfaces.renderkit.html.GradientA/DATB/eAF7emTy1lIvAA7XA7E_.jsf

      As you can see the filter is invoked three times and the URI are different.
      Why ?