jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes Header Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Header "Vary"" Watch "Header "Vary"" New topic

Header "Vary"

Bob Moranski
Ranch Hand

Joined: Nov 22, 2000
Posts: 177
Hi, I came across a aHttpServletResponse.setHeader("Vary", "Accept-Encoding"), but I had never heard of a header "Vary". This is called in a code, that depending on the request header, will either a)send GZIP format b)ZIP format c)regular OutputStream. So, I suspect the "Vary" header gives servlet flexibility in this regard. Am I right? Can someone please confirm to it?
Sagar Sharma
Ranch Hand

Joined: Aug 31, 2000
Posts: 92
i would also need reply to it....i have faced a similar type of code.
pls. clarify

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13035
I found the Vary header in RFC 2616 - the HTTP 1.1 definative document. Thats a long section so I am just quoting the first paragraph:
"The Vary field value indicates the set of request-header fields that fully determines, while the response is fresh,
whether a cache is permitted to use the response to reply to a subsequent request without revalidation. For
uncacheable or stale responses, the Vary field value advises the user agent about the criteria that were used to select
the representation. A Vary field value of �*� implies that a cache cannot determine from the request headers of a
subsequent request whether this response is the appropriate representation. See section 13.6 for use of the Vary
header field by caches."
Download your very own copy from: http://www.w3.org/
So it looks like Vary controls caching somehow.

author of:
Bob Moranski
Ranch Hand

Joined: Nov 22, 2000
Posts: 177
Thank you Bill, you are our X-mas present!
I agree. Here's the link: http://aspose.com/file-tools
subject: Header "Vary"
It's not a secret anymore!