• Post Reply Bookmark Topic Watch Topic
  • New Topic

Updating Cache  RSS feed

 
Rajendar Goud
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to update cache from JSP,when ever something is changed in the application..like ,update the page which had been changed from the browser ,instead of restarting the server...
rgds
Rajendar
 
Faisal Khan
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure if I understood your question correctly but you can use the following to stop the caching of web pages:
response.setHeader("Cache-Control","no-store"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader("Expires", -1); //prevents caching at the proxy server
 
Rajendar Goud
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Faisal,
well yes we can remove the cache using that,
but i want to write in a common jsp,which will update the application or
the page when ever something is changed... i hope iam clear..
so,if i need to write in a common jsp,how to proceed...
rgds
Rajendar
 
Vijay S. Rathore
Ranch Hand
Posts: 449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rajender,
I think you are saying that whenever you change something on the JSP page during development it should refresh the page on server. Well lot of advanced web servers like Websphere etc. do it automatically. You don't have to write a program or a common JSP to do it. Simply check your web/app server weather it supports this feature or not.

BTW which web server you are using?
 
Rajendar Goud
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijay,
ok i will check it out
iam using the iplanet webserver4.1
 
john fuhr
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this one:
int sleepTime = 1; //or whatever
response.setHeader("Cache-Control","no-store"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader("Expires", -1); //prevents caching at the proxy server
(thank you Faisal)
and then this
out.print("update my object: '" + myBean.getMessage() + "');
try{
out.flush();
response.flushBuffer();
Thread.sleep(sleepTime);
}catch(InterruptedException e){}
////
you may not need a Thread at all sepending on your app.
this flushes the response as well as flushes the PrintWriter...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!