We’ve chosen to use GWT for Beaver Creek Consulting’s latest product (Simply Schedules). The back end is a REST API with JSON payloads.
I was having trouble with the hosted mode browser. A list of application objects for a luser are loaded with a request to the server such as:
GET /app/luser/items
The issue is that as the application runs, the list of items on the server changes. Next time I tried to load the list of items from the server, the hosted browser sees the same URL and decides to use the cached response.
This post on the GWT forum recommended clearing the IE (if you are on windows) cache. I needed something more permanent as the cache issue is part of the normal operation of the client (this is to say it modifies the items).
The correct answer is to not clear the cache, but to bust the cache. A little bit of research shows that appending a query parameter with a random number or a timestamp will do the trick. For the above example, I used the current timestamp:
GET /app/luser/items?cache-buster=1233516109751
The timestamp is generated in “Java” on the client:
String url = "/app/luser/items?cache-buster=" + new java.util.Date().getTime();
It’s quite likely that you don’t even need to name the parameter, just append the time stamp:
GET /app/luser/items?1233516109751