| Author |
Caching the web page in client machine's browser
|
Rajendiran R. prakash
Greenhorn
Joined: Nov 22, 2007
Posts: 19
|
|
Hi Friends, I'm struck up with one issue in caching the web page in client machine's temporary internet files. I have designed a secured web application. I used <% response.setHeader("Cache-Control","no-cache"); response.setHeader("Pragma","no-cache"); response.setDateHeader ("Expires", 0); %> for not storing the web page in client machine. Now only some of the pages that doesn't needs the security needs to be cached in the client machines temporary internet files. For that i used the code as <% response.setHeader("Cache-Control","public"); response.setHeader("Pragma","public"); response.setDateHeader ("Expires", 0); %> Still i'm unable to store. Please help me solve this. Thanks in Advance. Quick help would be greatly appreciated. Thanks and regards, Prakash
|
 |
David O'Meara
Rancher
Joined: Mar 06, 2001
Posts: 13459
|
|
I tend to use something like these when encouraging resources to be cached:
|
[ JavaRanch FAQ ][ Book Promotions ][ DbTamer ][ BumperStickers ][ JavaRanch Badges ]
|
 |
Rajendiran R. prakash
Greenhorn
Joined: Nov 22, 2007
Posts: 19
|
|
Hi friend, Thanks for the quick reply. But it doesn't work. Is there any other idea. Thanks & Regards Prakash...
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13433
|
|
Originally posted by Rajendiran R. prakash: Hi friend, Thanks for the quick reply. But it doesn't work. Is there any other idea. Thanks & Regards Prakash...
Maybe you could give us a little more to work with than "it doesn't work". How do you know it doesn't work? What did you do to test it? What were you expecting? What did you see? I, for one, wouldn't spend very much effort to help you after seeing how quickly you dismissed David's response. [ March 13, 2008: Message edited by: Ben Souther ] [ March 31, 2008: Message edited by: Ben Souther ]
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples
|
 |
Rajendiran R. prakash
Greenhorn
Joined: Nov 22, 2007
Posts: 19
|
|
Hi Ben, When i used the above code with some slight alterations, it works for my system(Stand alone). But when i tried with another system with this systems url it doesn't works. Help me please.... Sorry if it hurts David......... Regards, Prakash. It Would be helpful if it is still clear....
|
 |
Rajendiran R. prakash
Greenhorn
Joined: Nov 22, 2007
Posts: 19
|
|
Hi Ben and David, Sorry for that. It really hurts some one who help others. It works perfectly for me. I used the david's code with some alterations. Now i changed my code according to David's code. While i use that exactly the same way, it works perfectly. Also I had some browser issue. Once i reset it to default settings and tried it works fine.
|
 |
David O'Meara
Rancher
Joined: Mar 06, 2001
Posts: 13459
|
|
Thanks for the feedback. This is an important issue with respect to caching or not caching data on the client. Anything you do is just a request to the client and they are free to do what they want. That is, you can ask them to cache the code and they may decide not to, or you may ask them to cache the data and they may decide not to.
|
 |
Rajendiran R. prakash
Greenhorn
Joined: Nov 22, 2007
Posts: 19
|
|
Thank you David, I feel sorry for that reply.
|
 |
David O'Meara
Rancher
Joined: Mar 06, 2001
Posts: 13459
|
|
Nothing personal I should also point out that the best you can do is look at the response headers too make sure the headers are being sent.
|
 |
 |
|
|
subject: Caching the web page in client machine's browser
|
|
|