users@jersey.java.net

Is setMaxAge needed at notModified()?

From: Markus KARG <markus.karg_at_gmx.net>
Date: Sun, 27 Jul 2008 17:41:03 +0200

Hi Jersey Community,

I am doing some experiments with Jersey-0.8 and HTTP Caching. Explicitly
I am checking how to efficiently implement support for conditional
requests in a JSR-311 resource to reduce the actual workload in
subsequent processes like JPA / JDBC etc.

In some test line I noticed that when using "return
Response.notModified().build();" then the clients behave differently:
Some browsers' chaches interpret it in a way that the cached entity is
"fresh" again for the max-age defined in the ORIGINAL response, while
other browsers' caches interpret it in a way that the cached entity is
revalidated but keeps "stale" status. As a result some browsers do not
validate once more for a another max-age period, while others still
revalidate each single subsequent request.

I know that it is not 100% on-topic in this forum, but I am new to the
HTTP/1.1 protocol on this technical level and like to know whether I
have to send "return
Response.notModified().cacheControl(myMaxAgeCacheControl).build();"
instead of "return Response.notModified().build();" to get the same
result in all browsers, or whether I am doing something wrong. Certainly
I want that all browsers behave the same. Is it my fault that they
behave differently, or is it a bug in one of the browsers (or in Jersey)?

Thanks
Markus

-- 
http://www.xing.com/go/invita/58469