Tuesday, June 29, 2010

Re: how to make javascripts,static images and css cacheable...

All the code generated by GWT (css, javascript, images).

Are cacheable by default, since the name of the resource is generated
by the hash of the contents (i think it is CRC 32, but not sure).

The best way to cache things is to let your web-server handle this.

Apache, nginx, tomcat have a very good cache mechanism which adds some
special headers inside the HTTP Response and those headers are
understood by almost any browser.

You can configure your server to mark all *.cache.* files to be cached
forever. If you change the code of your app, the GWT will change the
name of the files and then change what is requested from the server,
so the old files will not be used and the browser will discard them

The only caution is to disable the cache for the files *.nocache.*
because these files will not change and the browser must download them
every time the user goes to your application. Luckly there are only a
few files (sometimes can be only one file) that will be non-cacheable.

The solution proposed by Nirmal is the way to go (especially the
CacheFilter), but check the new docs because the way Css and
ImageResources are handled changed to a better way in the more new
version of GWT.

On 29 jun, 09:25, Aditya <007aditya.b...@gmail.com> wrote:
> hello,
> I m using GWT on client side which includes lots of code and lots of
> processing which makes my GWT modules little heavier and
> Whenever i test it online it loads little slower than it was expected
> when i searched around the web i found the solution that I can
> make my static content cacheable i have pure HTML pages i dont know
> how to make it cacheable.
> I have included meta tags in my pages but most of the browser doesn't
> support these meta tags.
> So what could be done in such situation...?
> --
> Aditya

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment