开发者

How to disable http caching in applet

开发者 https://www.devze.com 2023-03-21 15:31 出处:网络
How can i disable http caching of all my http connections in my japplet? I dont want any of my http (request/response)to be cached.Regardless of the user settings in control panel\\java\\Temporary Fil

How can i disable http caching of all my http connections in my japplet? I dont want any of my http (request/response)to be cached.Regardless of the user settings in control panel\java\Temporary File Settings. Applet is signed and compiled with java1.6.

I am using URLConnection.class and my request to an 3rd party web ser开发者_运维技巧vice is being cached.

ie:

I can see my request url in Java Cache Viewer. http://www.service.com?param1=232&param2=2323232

Also i can find the responses in application ....users\data\sun\java\deployment\cache

responseline1

responseline2


You can disable caches using URLConnection.setUseCaches(boolean)


An easy way to break caching is to add a random value to the url ala:

String url = "http://www.example.com/?noCache=" + Math.Random();

0

精彩评论

暂无评论...
验证码 换一张
取 消