You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by RITWICK <ri...@yahoo.co.in> on 2005/12/29 08:11:04 UTC

Problem with Cache

Hi, 
      I have redirected a page through
   
              response.sendRedirect("../frame.html") 
   
  command.
     Every time the servlet is called it updates the file.html & is redirected to it.But the problem is the browser shows the file.html from its cache everytime. Though the file gets updated the output can be viwed correctly only when it is refreshed.I've tried to clear the cache with :
   
  response.setHeader("Pragma", "no-cache");
  response.setHeader("Cache-Control", "no-cache");
  response.setDateHeader("Expires", 0); 
   
  but without avail. 
     I'm using jakarta-tomcat-4.1.27. Apparently it doesnt seem that it is a tomcat problem, but at the same time, for a trial run it was tested on jakarta-tomcat-5.0.27 & the results were fine! Now is there any rectification measures u can suggest so that it can be viewed under jakarta-tomcat-4.1.27
                                                              ritw
   
  Note: I'm using mozilla firefox with jakarta-tomcat-4.1.27. 

Send instant messages to your online friends http://in.messenger.yahoo.com 

Re: Problem with Cache

Posted by RITWICK <ri...@yahoo.co.in>.
   I,ve done it using:
   
  String myURL = "../frame.html";
myURL += "?" + Math.random();
response.sendRedirect(myURL);
   
  the url's are also changed with different random tags.But the problem stll exists very much.
     I've thought an alternative to stram the file to the browser through Filestram setting the mimetype.Howver its just a thought.
     Howver it would be better if the solution was less laborious than the one which I thought
                                                                      Thanx
                                                                                     Ritwick
   

Send instant messages to your online friends http://in.messenger.yahoo.com 

Re: Problem with Cache

Posted by Pete Lamborne <pe...@maniatv.com>.
tack a random number on the url.

String myURL = "../frame.html";
myURL += "?" + Math.rand();

response.sendRedirect(myURL)

The headers wouldn't help cachebust a static html file, you'll have to do it this way.

HTH
pete






RITWICK wrote:

>Hi, 
>      I have redirected a page through
>   
>              response.sendRedirect("../frame.html") 
>   
>  command.
>     Every time the servlet is called it updates the file.html & is redirected to it.But the problem is the browser shows the file.html from its cache everytime. Though the file gets updated the output can be viwed correctly only when it is refreshed.I've tried to clear the cache with :
>   
>  response.setHeader("Pragma", "no-cache");
>  response.setHeader("Cache-Control", "no-cache");
>  response.setDateHeader("Expires", 0); 
>   
>  but without avail. 
>     I'm using jakarta-tomcat-4.1.27. Apparently it doesnt seem that it is a tomcat problem, but at the same time, for a trial run it was tested on jakarta-tomcat-5.0.27 & the results were fine! Now is there any rectification measures u can suggest so that it can be viewed under jakarta-tomcat-4.1.27
>                                                              ritw
>   
>  Note: I'm using mozilla firefox with jakarta-tomcat-4.1.27. 
>
>Send instant messages to your online friends http://in.messenger.yahoo.com 
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org