File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clearing cache in servlets

 
ford Darcy Jr
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to clear cache using servlets, to prevent duplicate records getting inserted. My servlets has some header variable information relating to username.
I am trying to clear the cache by using:
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 1);
But, this doesnt seem to work. Can anybody please help.

Thanks
[ February 08, 2006: Message edited by: ford Darcy Jr ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That will not clear the cache. It will tell the browser not to cache the current "page".
 
ford Darcy Jr
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for the reply. Can you please tell me, what should I modify in that to get a solution.

Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no way for a response to tell the browser to clear its cache. That is completely under user control.
 
ford Darcy Jr
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Clearing cache using the response.setHeader("cache", "no-cache"), works fine on tomcat, but doesnt work when moved to weblogic server. Any idea what needs to be used on weblogic server for clearing cache to work.

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are mistaking clearing the cache with preventing a page from being cached in the first place.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic