3 Replies Latest reply on Nov 8, 2010 10:23 AM by mglowacki

    richfaces scripts reloaded on each new page

    mglowacki

      hi,

       

        I have a problem with two resources being loaded on each page change: ui.pack.js and framework.pack.js. Those are big bastards so I'd like them to be cached. I have set up loadind style strategy to ALL, I removed:

       

                  <meta http-equiv="Pragma" content="no-cache" />
                  <meta http-equiv="Cache-Control" content="no-cache" />
                  <meta http-equiv="Expires" content="0" />

                  <meta http-equiv="Pragma" content="no-cache" />

                  <meta http-equiv="Cache-Control" content="no-cache" />

                  <meta http-equiv="Expires" content="0" />

       

      from my html <head> section and problem still persists. Exactly it is like this:

       

      I go to mydomain.com/pageA.xhtml - scripts reloaded

      i refresh using F5 - scripts not reloaded

      I go to pageB - scripts reloaded

      I go back to pageA - scripts reloaded.

       

      Only situation they are not reloaded is when I press F5. Even being on pageA and clicking a link there to pageA results in scripts reload.

       

      Perhaps it's not RF as I see other smaller scripts behave the same way.

       

      I am using RF 3.2.2 SR1 with JBoss Seam 2.2.0

       

      Regards,

      Michal

        • 1. Re: richfaces scripts reloaded on each new page
          mglowacki

          Sorry, my scripts are reloaded even with F5, but this is probably because a4j:loadStyle adds some attributes to src of each style, like node1=dfas43dsf...

           

          One more tip, no tomcat/apache is adding pragma: no-cache etc himself. Result html is clean of this.

          • 2. Re: richfaces scripts reloaded on each new page
            nbelaevski

            Hi Michal,

             

            Please check the following issue: https://jira.jboss.org/browse/RF-7452 . Also does the problem affect HTTPS or HTTP?

            • 3. Re: richfaces scripts reloaded on each new page
              mglowacki

              hi Nick,

               

                it affects both HTTP and HTTPS. My page is redirected to secure connection anyway, but I made tests on HTTP as well. Now I tried with Live HTTP headers FF plugin and this is the header for one of a4j elements.

               

               

              HTTP/1.1 200 OK
              Server: Apache-Coyote/1.1
              X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1, JSF/1.2
              Cache-Control: max-age=86400
              Last-Modified: Mon, 08 Nov 2010 12:26:24 GMT
              Expires: Tue, 09 Nov 2010 14:56:47 GMT
              Content-Type: text/css;charset=ISO-8859-1
              Transfer-Encoding: chunked
              Content-Encoding: gzip
              Vary: Accept-Encoding
              Date: Mon, 08 Nov 2010 14:56:47 GMT

              HTTP/1.1 200 OK

              Server: Apache-Coyote/1.1

              X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1, JSF/1.2

              Cache-Control: max-age=86400

              Last-Modified: Mon, 08 Nov 2010 12:26:24 GMT

              Expires: Tue, 09 Nov 2010 14:56:47 GMT

              Content-Type: text/css;charset=ISO-8859-1

              Transfer-Encoding: chunked

              Content-Encoding: gzip

              Vary: Accept-Encoding

              Date: Mon, 08 Nov 2010 14:56:47 GMT

               

              The link you gave me, looks like I could match some of the infos to my case. Like the content of authent. resources is not cached. This is part of my web.xml

               

               

              <security-constraint>

                  <display-name>Restrict raw XHTML Documents</display-name>

                  <web-resource-collection>

                    <web-resource-name>XHTML</web-resource-name>

                    <url-pattern>*.xhtml</url-pattern>     

                  </web-resource-collection>

                  <auth-constraint/>

                </security-constraint>

                <login-config>

                  <auth-method>BASIC</auth-method>

                </login-config>

               

              I tried adding:

              <web-resource-collection>

                    <web-resource-name>unrestricted</web-resource-name>

                    <url-pattern>/MyPage/a4j/*</url-pattern>     

                    <url-pattern>/MyPage/scripts/*</url-pattern>     

                  </web-resource-collection>

               

              to see if it could be the issue, but unfortunately the javascript stopped working then :/