Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    SmartGwt static content browser cache issue

    Hi,

    Code:
    <gwtVersion>2.3.0</gwtVersion>
    <smartGwtVersion>3.0</smartGwtVersion>
    Tomcat Server 7.0
    Browsers: IE, Chrome, Firefox (not tested in others)
    GWT.XML:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <module rename-to='xyb'>
      <inherits name='com.google.gwt.user.User' />
      <inherits name="com.google.gwt.xml.XML" />
    
      <inherits name="com.google.gwt.i18n.I18N"/>
      <inherits name='com.google.gwt.user.theme.standard.Standard'/>
      <inherits name="com.smartclient.theme.silverwave.SilverWave" />
      <inherits name="com.smartclient.theme.enterprise.Enterprise"/>
    
      <!-- Supported Locale -->
      <extend-property name="locale" values="en"/>
      <extend-property name="locale" values="ja"/>
    
      <inherits name='com.smartgwt.SmartGwtNoScript'/>
      <entry-point class='com.xyz.EtryPoint' />
    
      <source path='client' />
      <source path='shared' />
    </module>
    We have a small three year old smartgwt project which runs on tomcat without a webserver, and there are no settings on tomcat to not to cache any files, but smartgwt static files like .js and .css files are not cached in browser, which is causing initial application load delay everytime user accesses the application, as mentioned in this link, I have added FileDownload servlet but this only chaching images but not js and css files. Can you please suggest how to cache .js and .css files. I have added release version as request param to static files so that I can cache them and when new release is deployed new file be fetched.

    http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/docs/Caching.html
    Code:
        <servlet>
            <servlet-name>FileDownload</servlet-name>
            <servlet-class>com.isomorphic.servlet.FileDownload</servlet-class>
            <init-param>
                <param-name>expires</param-name>
                <param-value>text/javascript:10000000,application/javascript:10000000,text/css:10000000,image/gif:10000000,image/png:10000000</param-value>
            </init-param>
        </servlet>
    
        <servlet-mapping>
            <servlet-name>FileDownload</servlet-name>
            <url-pattern>/isomorphic/system/modules/*</url-pattern>
        </servlet-mapping>
    
        <servlet-mapping>
            <servlet-name>FileDownload</servlet-name>
            <url-pattern>/isomorphic/skins/*</url-pattern>
        </servlet-mapping>
    Thanks in advance, pls refer to attached jpg for more info.
    Attached Files

    #2
    Adding another attachment

    may be this caused by ETag response header? if so please suggest how to remove this?
    Attached Files

    Comment


      #3
      You don't have to do anything for correct caching to occur, it's the default. So the question here is really - what have you changed, relative to the default installation, that broke caching?

      First thing to do is to show us the HTTP headers on the HTTP response from any of the files that should be cached but isn't, such as ISC_Core.js.

      No, do not try to remove ETags.

      Comment


        #4
        I am also not sure whats happening, its been like this since long time, and I am now trying to understand and fix this. please find the request and response headers of ISC_core.js, please note that web application only runs under https

        Code:
        Request URL:https://test.com/test/Test/sc/modules/ISC_Core.js?1.9.4-SNAPSHOT
        Request Method:GET
        Status Code:200 OK
        
        Request Headers
        
        Accept:*/*
        Accept-Encoding:gzip,deflate
        Accept-Language:en-GB,en;q=0.8
        Cache-Control:no-cache
        Connection:keep-alive
        Cookie:JSESSIONID=F41EB7447141E6E8C6DCA99892E03B7B
        DNT:1
        Host:vms-dev.cctdev.com
        Pragma:no-cache
        Referer:https://test.com/test/Test.jsp
        User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36
        Query String Parametersview sourceview URL encoded
        1.9.4-SNAPSHOT:
        
        Response Headers
        Accept-Ranges:bytes
        Content-Length:695490
        Content-Type:application/javascript
        Date:Fri, 19 Sep 2014 20:13:54 GMT
        ETag:W/"695490-1411132124666"
        Last-Modified:Fri, 19 Sep 2014 13:08:44 GMT
        Server:Apache-Coyote/1.1

        Comment


          #5
          This response appears to be coming directly from Apache - the request never makes it to Tomcat or to SmartGWT server code at all.

          So you need to either allow these requests through to Tomcat, or you should configure Apache to set up caching as desired.

          At least for the .js files, we highly recommend just passing these through to Tomcat, as correctly configuring Apache for compression is non-trivial (there are a lot of explanations of how to do it on the web, but none of them contain all the necessary workarounds for browser bugs).

          Comment


            #6
            Thanks, but there is no apache web server, app is directly running on tomcat 7, its same on my local tomcat server. I am thinking its some tomcat setting on https is causing this issue. Do you have any idea about this?

            Comment


              #7
              Sorry, we should have said: this response is being served by the Apache-Coyote connector in Tomcat, without SmartGWT server-side code being involved at all.

              You can easily verify this by modifying log4j.isc.config.xml to allow INFO or DEBUG-level logs for the FileDownload category to appear - you should see no logs from SmartGWT when eg ISC_Core.js is downloaded.

              As to why this is occurring, it would again be some non-default setting you've applied in Tomcat, or something like a Filter servlet you've added that downloads files without involving SmartGWT server code.

              Comment

              Working...
              X