8 Replies Latest reply on Aug 29, 2007 7:56 PM by ckadam

    GZipCompression Filter & a4j

      Hi All,

      I have added GZip Compression filter to my web.xml. But after adding that, I have started to notice substantial delay when downloading prototype.js file from the server. (http://hostname/a4j.res/prototype.js.jsf). It takes almost 20 seconds to finish the request.

      When inspected the response using FireBug, I found that compressed file was 14kb, but content-length header was set to 54 KB. This mismatch was causing the request to be open for longer time.



      Response Headers
      Server Apache-Coyote/1.1
      X-Powered-By Servlet 2.4; JBoss-4.0.3 (build: CVSTag=JBoss_4_0_3 date=200510042324)/Tomcat-5.5
      Last-Modified Wed, 29 Aug 2007 05:18:24 GMT
      Cache-Control max-age=86400
      Expires Thu, 30 Aug 2007 17:29:25 GMT
      Content-Encoding gzip
      Content-Type text/javascript
      Content-Length 54326
      Date Wed, 29 Aug 2007 17:32:02 GMT
      
      
      Request Headers
      Host smdevdk12:8080
      User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
      Accept text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
      Accept-Language en-us,en;q=0.5
      Accept-Encoding gzip,deflate
      Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
      Keep-Alive 300
      Connection keep-alive
      Cookie JSESSIONID=8D2F7C25B04C3CEEEE97E53F8AC04C67.localhost


        • 1. Re: GZipCompression Filter & a4j

          Has anyone come across this problem ? Thanks.

          • 2. Re: GZipCompression Filter & a4j

            This is a problem of filter, not ours. Default deflate compressor in Tomcat set the length right.

            • 3. Re: GZipCompression Filter & a4j

              Sergey, Thanks for quick response.

              Once I get rid of GZipFilter from web.xml, then I do not see this problem. But this may not be acceptable solution for us.

              So I did debug the GZipCompression filter code, and found that GZipFilter is not changing the content-length header at all. So i am not really sure, who is setting the header value.

              Is A4J, serving any of the resources in compressed format ?

              Is there any recommended way for applying GZipCompression on JSF pages served using Jboss ?

              • 4. Re: GZipCompression Filter & a4j
                alexsmirnov

                Jboss AS bundled with a Apache Tomcat, where is compression built-in at the Connector level. See http://tomcat.apache.org/tomcat-6.0-doc/config/http.html , compression attribute description.
                For a Jboss 4.2.1, edit $JBOSS_HOME/server/default/deploy/jboss-web.deployer/server.xml

                • 5. Re: GZipCompression Filter & a4j
                  alexsmirnov

                  Content-Length response header is setted by RichFaces resource framework. It value is important for a properly resource caching ( most browsers don't cache objects for unknown length ).

                  • 6. Re: GZipCompression Filter & a4j

                    Alex,

                    Thanks for response. I will look into those resources.

                    But I just wanted to bring up one more thing. On my page, I have modalPanel. So resources related to that are downloaded from these server as well. But I their case, content-length header is set correctly. So I am confused about, what so special about prototype.js resource.

                    e.g.

                    http://smdevdk12:8080/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf

                    Response Headers
                    Server Apache-Coyote/1.1
                    X-Powered-By Servlet 2.4; JBoss-4.0.3 (build: CVSTag=JBoss_4_0_3 date=200510042324)/Tomcat-5.5
                    Last-Modified Wed, 29 Aug 2007 18:23:42 GMT
                    Cache-Control max-age=86400
                    Expires Thu, 30 Aug 2007 19:18:29 GMT
                    Content-Encoding gzip
                    Content-Type text/javascript
                    Content-Length 10268
                    Date Wed, 29 Aug 2007 19:18:29 GMT
                    
                    
                    Request Headers
                    Host smdevdk12:8080
                    User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
                    Accept */*
                    Accept-Language en-us,en;q=0.5
                    Accept-Encoding gzip,deflate
                    Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
                    Keep-Alive 300
                    Connection keep-alive
                    Referer http://smdevdk12:8080/config/showConfigurations.jsf
                    Cookie JSESSIONID=B260D08B0315E0E534125702FBA3B539.localhost


                    • 7. Re: GZipCompression Filter & a4j
                      alexsmirnov

                      Different values for a content length provided by filter, framework itself set real value for a resources with known size.
                      Wich implementation of a GZipFilter is used ?

                      • 8. Re: GZipCompression Filter & a4j