Maksim
Maksim

Reputation: 16931

Refreshing GWT application on client's side

I have written application using GWT. It works perfectly for the client. But when I'm changing something in my application, recompiling and then deploying to the server and client access my application his browser is not picking up the new version of the application but uses previously cached version of it. This triggers RPC errors and other problems.

How can I force client's browser to get a new version of the application when they are visiting my page and use the cached version if it is matches version on the server.

Upvotes: 13

Views: 12923

Answers (2)

user467871
user467871

Reputation:

This topic can help you in clearing the cache : how to clear cache in gwt?

Upvotes: 3

Chris Lercher
Chris Lercher

Reputation: 37778

Make sure, that your "*.nocache.*" files and your start page (usually "index.html") are served with the correct HTTP caching headers. See Ideal HTTP cache control headers for different types of resources for a discussion on this (somewhat difficult) topic. Basically, you'll probably want to set

Cache-Control: no-cache

for these files. (By the way, this forces a re-download only when the file has changed!)

How to do this configuration, depends on your web server (for Apache Httpd, you can use this guide).

Alternatively - if you use a JavaEE server (Tomcat, Jetty, ...) to serve these files - you can use a Servlet Filter. Maybe you'd like to use my example from How to set Expires HTTP header on a single JS file in Apache Tomcat?

Upvotes: 13

Related Questions