• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

request's no-cache vs response's no-cache

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
I just joined the forum. I'm learning Servlet/JSP. I stand somewhere on the intermediate level.
I googled to understand the difference between request's no-cache and response's no-cache but couldn't find some easy explanation with examples. I know response's no-cache is used whether browser client should cache the page locally or not. What is the practical use of request's no-cache header?

Thanks in advance for the responses.

Erin.
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does this help? http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1
 
Erin Li
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mark,
What I understood from rfc is:
Request Cache-Control header tells us what is the browser default cache-ability and server can override that default cache-ability via response's header.
Please let me know whether my understanding is correct.

I wrote a servlet to test cache-control header:



I am expecting the browser to get the copy of page from cache, that doesn't seem to happen as it prints the new date whenever I refresh/request for the servlet resource. Please let me know what I'm missing here.

Thanks
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't force the browser to cache the page. That's a matter that the browser decides based upon divergent circumstances, differing browser implementations, and user-specified settings.

All the headers do is to inform the browser of your intentions. The browsers will then do whatever they darn well please.

Trying to exert completely deterministic control over browser actions is impossible, and leads to madness and hair loss.
 
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:You can't force the browser to cache the page....Trying to exert completely deterministic control over browser actions is impossible, and leads to madness and hair loss.


And conversely, you can't force the browser to not cache the page. All you can do is give hints to the browser, which will often ignore your hints.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the term that best describes browsers is capricious.
 
reply
    Bookmark Topic Watch Topic
  • New Topic