• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlets and cache

 
david allen
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have just been looking at my site from the library and they must use a proxy server and when you update a page it does not show they changes until you refresh. How can I stop this.
thanks
david
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can set an entry in the HTTP header. Just set in your response

This shows the Proxy to not cache the side.
This is the entry for Http 1.1 for Http 1.0 it is slightly different as
far as i can remember. You can check this on the W3C page
 
Gayan Balasooriya
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This method disables caching at the proxy and client browser
// Set to expire far in the past.
response.setHeader("Expires", "Sat, 6 May 1995 12:00:00 GMT");
// Set standard HTTP/1.1 no-cache headers.
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
// Set IE extended HTTP/1.1 no-cache headers (use addHeader).
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
// Set standard HTTP/1.0 no-cache header.
response.setHeader("Pragma", "no-cache");
Gayan Balasooriya
SCJP,SCWCD
http://www.gayanb.com - Free Java/J2EE books and mock exams
[ October 21, 2003: Message edited by: Gayan Balasooriya ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic