Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
567 views
in Technique[技术] by (71.8m points)

how to clear cache in gwt?

How can I clear the cache in gwt?

or is there any way that prevent browser to keep the cache in gwt?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

When you deploy a GWT-application it's important to avoid proxies and browsers to cache the .nocache.js-files generated by GWT. One solution is to implement a servlet filter that adds the necessary HTTP-headers that control the caching behaviour.

Here's such a filter: http://seewah.blogspot.com/2009/02/gwt-tips-2-nocachejs-getting-cached-in.html

The headers in that example are:

Date: Wed, 24 Nov 2010 20:32:43 GMT
Expires: Wed, 01 Nov 2000 00:00:00 GMT
Pragma: no-cache
Cache-Control: no-cache, no-store, must-revalidate

Date should be set to the time of the request.

Expires is best set to sometime in the past, this forces everyone to consider the content already stale.

Pragma is a tag that has been superseded by Cache-Control, but it doesn't hurt to have it.

Cache-Control no-cache means a browser or proxy must revalidate a cached copy before releasing it to the client. no-store means no one is ever keeping a cached copy (which makes no-cache redundant). must-revalidate says the browser/proxy must obey freshness information and revalidate, also redundant with no-store.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...