14 Replies Latest reply on May 15, 2009 2:58 PM by Chris Dollar

    LoadScriptStrategy NONE problem

    Chris Dollar Novice

      I am trying to use LoadScriptStrategy NONE in my app (have been using DEFAULT up until now) and am getting some javascript errors. I'm using JBoss 4.2.2.GA with RF 3.3.0.GA and facelets. I grabbed framework.pack.js and ui.pack.js from the RF jar files and have them being served locally. This is what I've added into the head of my facelets template:

      <f:view>
       <head>
       <script src="../js/RF-3.3.0/framework.pack.js" type="text/javascript"/>
       <script src="../js/RF-3.3.0/ui.pack.js" type="text/javascript"/>
       <script type="text/javascript">window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script>
      ...
      

      I can see that the 2 .js files are loaded via firebug, and most things seem to work, but my rich:panelBar does not work and I get 2 javascript errors. The first is "D is undefined" from ui.pack.js line 3202. The second error is "Richfaces.PanelBar is not a constructor" and it doesn't reference any line in the js files.

      Does anyone have any ideas what is wrong? If I change the load strategy back to DEFAULT or ALL it seems to work.

      Thanks!
      Chris



        • 1. Re: LoadScriptStrategy NONE problem
          Chris Dollar Novice

          On a somewhat related topic, I've noticed some strange behavior when the RF scripts are requested via an SSL connection.

          When I have the script load strategy set to ALL on the first request (via https) for both the ui and framework scripts I get a 200 response and the files are downloaded, etc.

          After I logout and login again the scripts are requested (again via https) and this time I get a 304 Not Modified response and I can see that they are loaded from cache in firebug. Upon inspecting the request headers I see that this request has sent an "If-Modified-Since" header.

          From this point if I logout and login again the I get the 200 response and the scripts are downloaded. Logging out/in again will give me the 304 response and I get the cached files. I can repeat this process with every other request using the cached files.

          My goal is to be able to set the time that those files are cached to avoid the download time. I've set the org.ajax4jsf.DEFAULT_EXPIRE param in web.xml to 172800.

          Any ideas on this? Tested with FF3 on Win XP with firebug.

          Thanks again.
          Chris

          • 2. Re: LoadScriptStrategy NONE problem
            Chris Dollar Novice

            Bump...
            Any ideas??

            Thanks!
            Chris

            • 3. Re: LoadScriptStrategy NONE problem
              Nick Belaevski Master

               

              "cdollar393" wrote:
              I am trying to use LoadScriptStrategy NONE in my app (have been using DEFAULT up until now) and am getting some javascript errors. I'm using JBoss 4.2.2.GA with RF 3.3.0.GA and facelets. I grabbed framework.pack.js and ui.pack.js from the RF jar files and have them being served locally. This is what I've added into the head of my facelets template:
              <f:view>
               <head>
               <script src="../js/RF-3.3.0/framework.pack.js" type="text/javascript"/>
               <script src="../js/RF-3.3.0/ui.pack.js" type="text/javascript"/>
               <script type="text/javascript">window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script>
              ...
              

              I can see that the 2 .js files are loaded via firebug, and most things seem to work, but my rich:panelBar does not work and I get 2 javascript errors. The first is "D is undefined" from ui.pack.js line 3202. The second error is "Richfaces.PanelBar is not a constructor" and it doesn't reference any line in the js files.

              Does anyone have any ideas what is wrong? If I change the load strategy back to DEFAULT or ALL it seems to work.

              Thanks!
              Chris


              Chris, are these three scripts the only script inclusions on the page? The question is about whether there are some external (possibly conflicting) scripts.

              • 4. Re: LoadScriptStrategy NONE problem
                Nick Belaevski Master

                 

                "cdollar393" wrote:
                On a somewhat related topic, I've noticed some strange behavior when the RF scripts are requested via an SSL connection.

                When I have the script load strategy set to ALL on the first request (via https) for both the ui and framework scripts I get a 200 response and the files are downloaded, etc.

                After I logout and login again the scripts are requested (again via https) and this time I get a 304 Not Modified response and I can see that they are loaded from cache in firebug. Upon inspecting the request headers I see that this request has sent an "If-Modified-Since" header.

                From this point if I logout and login again the I get the 200 response and the scripts are downloaded. Logging out/in again will give me the 304 response and I get the cached files. I can repeat this process with every other request using the cached files.

                My goal is to be able to set the time that those files are cached to avoid the download time. I've set the org.ajax4jsf.DEFAULT_EXPIRE param in web.xml to 172800.

                Any ideas on this? Tested with FF3 on Win XP with firebug.

                Thanks again.
                Chris


                How's login/logout implemented?
                Also can you please make sure that this is not a Firebug issue by checking this with some external (like MS Fiddler) tool?

                • 6. Re: LoadScriptStrategy NONE problem
                  Chris Dollar Novice

                  I did have other scripts also being loaded (all just generic helper scripts -- no other large javascript libraries) but as a test I just removed all of them so that only the RF scripts were being loaded and I get the same behavior.

                  And I've not done tests with the fiddler tool -- I'll do some and report back.

                  Chris

                  • 7. Re: LoadScriptStrategy NONE problem
                    Chris Dollar Novice

                     

                    "nbelaevski" wrote:
                    "cdollar393" wrote:
                    On a somewhat related topic, I've noticed some strange behavior when the RF scripts are requested via an SSL connection.

                    When I have the script load strategy set to ALL on the first request (via https) for both the ui and framework scripts I get a 200 response and the files are downloaded, etc.

                    After I logout and login again the scripts are requested (again via https) and this time I get a 304 Not Modified response and I can see that they are loaded from cache in firebug. Upon inspecting the request headers I see that this request has sent an "If-Modified-Since" header.

                    From this point if I logout and login again the I get the 200 response and the scripts are downloaded. Logging out/in again will give me the 304 response and I get the cached files. I can repeat this process with every other request using the cached files.

                    My goal is to be able to set the time that those files are cached to avoid the download time. I've set the org.ajax4jsf.DEFAULT_EXPIRE param in web.xml to 172800.

                    Any ideas on this? Tested with FF3 on Win XP with firebug.

                    Thanks again.
                    Chris


                    How's login/logout implemented?
                    Also can you please make sure that this is not a Firebug issue by checking this with some external (like MS Fiddler) tool?


                    After doing tests with the fiddler tool I got some interesting results. I see the same behavior in the fiddler using firefox -- where every other request use the "If-Modified-Since" header and also alternate between the 200 and 304 responses. Using IE7 gets a 200 response code every time. (And this is looking at the response codes for things like the richfaces styles and scripts, etc.) If I examine the response codes for content I have being served statically from apache I see a code of 304 each time on both firefox and IE (observed in firebug and fiddler) which is what I think tomcat should be doing with the richfaces items since I have the expire settings set high in my web.xml.

                    I can provide the log output from the fiddler if needed.

                    So at this point I still have both problems: Using the NONE load strategy gives javascript errors and the behavior of caching the individual richfaces items (regardless of the script load strategy) with an SSL connection is not consistent. I'm happy to do more testing if someone can give me some ideas of what to look for. Any thoughts?

                    Thanks.
                    Chris

                    • 8. Re: LoadScriptStrategy NONE problem
                      Nick Belaevski Master

                       

                      I can provide the log output from the fiddler if needed.

                      Can you please post IE log?

                      • 9. Re: LoadScriptStrategy NONE problem
                        Chris Dollar Novice

                        Here is the fiddler output (headers only) for IE. http://pastebin.com/m3083ebb4

                        I started by clearing the IE cache and shutting down and restarting the browser. Then I logged in and out 3 times in a row. As you can see from the output the css and image files that are not part of the RF framework are served directly by apache and subsequent requests for those items get a 304 response. And for the RF items there is always a 200 response.

                        Thanks again for the help! Let me know if there is any other information I can provide.

                        Chris

                        • 10. Re: LoadScriptStrategy NONE problem
                          Nick Belaevski Master

                          Chris,

                          I see "Pragma: No-cache" directives in the response for RF resources. Can you please check if they are present in response for FF? Also I see you are using Apache web server, so does the problem reproduce if you connect directly to JBoss?

                          • 11. Re: LoadScriptStrategy NONE problem
                            Chris Dollar Novice

                            Yes, I do still get the "Pragma: no-cache" entry when I try with FF. Here's a snippit from the fiddler from the test:

                            GET /PermitExpress/content/a4j/g/3_3_0.GA/org/ajax4jsf/framework.pack.js HTTP/1.1
                            Host: 10.1.1.3
                            User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729)
                            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: https://10.1.1.3/PermitExpress/content/manager.jsf
                            Cookie: JSESSIONID=A3D491B9FFC0FD960B782AA77DBC7CBC
                            
                            
                            HTTP/1.1 200 OK
                            Date: Fri, 27 Mar 2009 17:32:36 GMT
                            Server: Apache/2.2.4 (Ubuntu) DAV/2 SVN/1.4.4 mod_jk/1.2.23 PHP/5.2.3-1ubuntu6.5 proxy_html/2.5 mod_ssl/2.2.4 OpenSSL/0.9.8e
                            Pragma: No-cache
                            Cache-Control: max-age=172800
                            Expires: Sun, 29 Mar 2009 17:32:36 GMT
                            X-Powered-By: Servlet 2.4; JBoss-4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)/Tomcat-5.5
                            Last-Modified: Fri, 27 Mar 2009 16:00:21 GMT
                            Content-Length: 303479
                            Keep-Alive: timeout=15, max=99
                            Connection: Keep-Alive
                            Content-Type: text/javascript
                            


                            I'm not sure how easy it will be for me to test the problem by directly connecting to JBoss since I am using SSL and letting apache handle the SSL virtual hosting rather than tomcat. Is there any other way to test it?

                            Thanks again.
                            Chris

                            • 12. Re: LoadScriptStrategy NONE problem
                              Nick Belaevski Master

                               

                              "cdollar393" wrote:
                              Yes, I do still get the "Pragma: no-cache" entry when I try with FF.
                              So, headers generated do not depend on the browser. Seems that FF just ignores "Pragma: no-cache", while IE does not.

                              I suggest that you deploy your application to JBoss locally and check if the problem is reproduced.

                              • 13. Re: LoadScriptStrategy NONE problem
                                Alexander Smirnov Master

                                This is old Tomcat 5.0 connector issue. For example, see discussion at http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg151294.html//www.mail-archive.com/tomcat-user@jakarta.apache.org/msg151294.html and referenced Tomcat issues.

                                • 14. Re: LoadScriptStrategy NONE problem
                                  Chris Dollar Novice

                                   

                                  "alexsmirnov" wrote:
                                  This is old Tomcat 5.0 connector issue. For example, see discussion at http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg151294.html//www.mail-archive.com/tomcat-user@jakarta.apache.org/msg151294.html and referenced Tomcat issues.


                                  Many thanks Alex! Doing the workaround described in the bug works for me. For anyone else that runs into this issue here is the JBoss fix from the wiki: http://www.jboss.org/community/wiki/DisableCacheControl

                                  I still need to dig into the script load strategy error issue some more.

                                  Thanks again!
                                  Chris