2

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 service 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

e13420xx
  • 718
  • 1
  • 8
  • 26
  • So which libraries are you using? What kind of calls do you make and are now being cached? Is the applet self the thing that is being cached? – M Platvoet Jul 19 '11 at 13:35

2 Answers2

3

You can disable caches using URLConnection.setUseCaches(boolean)

M Platvoet
  • 1,679
  • 1
  • 10
  • 14
0

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();

ali_bahoo
  • 4,732
  • 6
  • 41
  • 63
Frederik
  • 594
  • 3
  • 9
  • 24