4 Replies Latest reply on May 25, 2011 9:38 AM by acormond

    Many requests in filter for a single call

    acormond

      I have a fundamental servlet filter / jsf question.  I have set up a filter in my application for use in a security system.  This is the only filter configured for the application (RichFaces 4.0 no longer requires a filter, right?).  The filter is set up to only look at HttpRequests that end in "jsf".  A log statement in the filter prints out the request path.  This shows that for a single request for a JSF page:

       

      1. There are about 20 requests.  Most of these are for JSF components/resources
      2. The path for the requested page does not show up.  it does show up on the 2nd request for the page

       

      What's going on?  Shouldn't the request for a JSF page call the filter just once?

       

      Thanks for any help

       

      Alex Ormond

        • 1. Re: Many requests in filter for a single call
          nbelaevski

          Hi Alex,

           

          You are right, Faces Servlet provides rendering of JSF resource contents, so they are coming as *.jsf requests too.

          • 2. Re: Many requests in filter for a single call
            acormond

            Hi Nick,

             

            Thanks for the response, but I'm still confused.  The rendering of the JSF page happens on the server, right, so why is the servlet filter receiving more than one request from the client?  Said another way:

            1. The client sends a request for a JSF page
            2. The request is examined by the filter before it is sent to the server
            3. The request continues on to the server (the Faces Servlet)
            4. The servlet renders the response
            5. The filter might filter the outgoing response, except mine is set up to only examine requests
            6. The client receives the response

            Where did I go wrong?  Still, according to this scenario, the filter would only see one JSF request.  You would make me much happier if you cleared up this issue for me.

             

            Thanks,

             

            Alex

            • 3. Re: Many requests in filter for a single call
              nbelaevski

              Alex,

               

              With HTTP protocol client initiates new request for each resource. So, you have JSF page that refers another resources (components styles and scripts), so they are requested once the response HTML page hits the client.

              • 4. Re: Many requests in filter for a single call
                acormond

                Thank you sir. Yes, I'm much happier ..., well ...