This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes servlets and cache Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlets and cache" Watch "servlets and cache" New topic
Author

servlets and cache

david allen
Ranch Hand

Joined: Sep 27, 2002
Posts: 185
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

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Jul 31, 2002
Posts: 51
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 ]

SCJP, SCWCD
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: servlets and cache
 
Similar Threads
Cleared SCJP 6
Spotted: Megatron Tankā€¦ The Decepticons really ARE hiding in China!
I_________________________You
Repaint and ComponentListener
Finally I cleared SCJP!