View Full Version : Ie7 caching problem

12 May 2009, 3:54 PM

When using json to communicate with the server in Intenet Explorer 7 it caches the request so I dont get the latest data.
In Firefox the request gets processed every time.

Can someone let me know how to add a timestamp/parameter to the BasePagingLoader/json request so


would appear as


Code is

ColumnModel cm = new ColumnModel(ApprovalProcessGridHelper.getColumnConfig());

// Incoming data model type
ModelType type = ApprovalProcessGridHelper.getModelType();
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, "/ProductApproval/controller.json");

HttpProxy proxy = new HttpProxy(builder);

// Reading Json data
JsonReader<PagingLoadConfig> reader = new JsonReader<PagingLoadConfig>(type) {
protected ListLoadResult newLoadResult(PagingLoadConfig loadConfig, List<ModelData> models) {
PagingLoadResult result = new BasePagingLoadResult(models, loadConfig.getOffset(), loadConfig.getLimit());

return result;
// Loader
final BasePagingLoader loader = new BasePagingLoader(proxy, reader);


// Store
ListStore<ModelData> store = new ListStore<ModelData>(loader);

// Grid
grid = new Grid(store, cm) {
//show loading... on startup
protected boolean loaded;
protected void onAttach() {
if (!loaded) {
loaded = true;


grid.setTitle("Approval Process");

13 May 2009, 9:18 AM
There are a few ways to do this.
(1) Set the request header indicating you need a non-cached request (preferred)
(2) add something to the query string that is "random" like a request count from the page. (this is similiar to a sessionID). If your request URL is "unique" IE will not cache it.

Method 2 will be more difficult for you since your request builder/proxy is setup for a store and without a subclass of a Proxy/Builder there is no way to do this "on the fly" (I created my own RestfulHttpProxy for processing some of the REST requests in which I needed to change the uripath.)

Your best option is to set headers on the RequestBuilder. There is a method "setHeader( )" on this class (see GWT Javadoc).

If you look at the HTTP 1.1 RFC: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
You will want to use the "Cache-Control" key. For no caching, you should try the


Another option is the "must-revalidate". See the RFC for these definitions.

Finally, if you have control over the server, this is something you might want to do from that side. In my clients case, the client is not intelligent and simply processes what it is given. This this case, I have my server code setting the headers on the response such that the browser will always clear the data if appropriate.