Hi, Paul,
> Is it not the case that "If-Modified-Since" should only work with GET or HEAD
> regardless of other precondition headers?
Sorry, i don't know other preconditions can be ignored in the above case.
but i agree "If-Modified-Since" should only work with GET or HEAD.
> Would it be possible for you to log an issue?
I'll submit this issue later.
Thanks,
Hisaaki Sato.
--- "Paul Sandoz" <Paul.Sandoz_at_Sun.COM> ---
>Hi Hisaaki,
>
>I agree i think you found an issue, in the following code:
>
> public ResponseBuilder evaluatePreconditions(Date lastModified,
>EntityTag eTag) {
> ResponseBuilder r = evaluateIfMatch(eTag);
> if (r == null) {
> long lastModifiedTime = lastModified.getTime();
> r = evaluateIfUnmodifiedSince(lastModifiedTime);
> if (r == null)
> r = evaluateIfNoneMatch(eTag);
> // If there is no entity tag match for "If-None-Match" then
> // the "If-Modified-Since" header should be ignored
> // so that it is not possible to return a 304 Not
>Modified response
> if (r == null) <------- r == null does not signal that
>none of the entity tags match
> because the "If-None-
>Match" header could be absent
>
> return null;
> r = evaluateIfModifiedSince(lastModifiedTime); <-----
>this should only occur if the HTTP method
> is
> GET or HEAD
> if (r != null)
> r.tag(eTag);
> }
>
> return r;
> }
>
>And IIUC if there is a match then "If-Modified-Since" processing
>should proceed if and only if the HTTP method is "GET" or "HEAD". Is
>it not the case that "If-Modified-Since" should only work with GET or
>HEAD regardless of other precondition headers?
>
>Would it be possible for you to log an issue?
>
>Thanks,
>Paul.
>
>On Feb 23, 2009, at 6:46 AM, Hisaaki Sato wrote:
>
>> Hi,
>>
>> I found an issue at the evaluatePreconditions
>> method(ContainerRequest).
>> It seems re-evaluate after If-Unmodified-Since check and
>> precondition failed(412).
>> This method should be as follows, I think.
>>
>> public ResponseBuilder evaluatePreconditions(Date lastModified,
>> EntityTag eTag) {
>> String ifMatchHeader = getRequestHeaders().getFirst("If-Match");
>> String ifNoneMatchHeader = getRequestHeaders().getFirst("If-None-
>> Match");
>> String ifUnmodifiedSinceHeader = getRequestHeaders().getFirst("If-
>> Unmodified-Since");
>> String ifModifiedSinceHeader = getRequestHeaders().getFirst("If-
>> Modified-Since");
>> long lastModifiedTime = lastModified.getTime();
>> ResponseBuilder r = null;
>> if (ifMatchHeader != null) {
>> r = evaluateIfMatch(eTag);
>> if (r != null)
>> // 412 Precondition Failed
>> return r;
>> }
>> if (ifUnmodifiedSinceHeader != null) {
>> r = evaluateIfUnmodifiedSince(lastModifiedTime);
>> if (r != null)
>> // 412 Precondition Failed
>> return r;
>> }
>> if (ifNoneMatchHeader != null) {
>> r = evaluateIfNoneMatch(eTag);
>> String httpMethod = getMethod();
>> if (r == null || !(httpMethod.equals("GET") ||
>> httpMethod.equals("HEAD")))
>> // 200 OK
>> // 412 Precondition Failed
>> return r;
>> }
>> if (ifModifiedSinceHeader != null) {
>> if (r == null) {
>> r = evaluateIfModifiedSince(lastModifiedTime);
>> } else {
>> // 304 Not modified
>> // ETag already set by If-None-Match
>> if (evaluateIfModifiedSince(lastModifiedTime) == null)
>> r == null;
>> }
>> }
>> return r;
>> }
>>
>> Thanks,
>> Hisaaki Sato
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>For additional commands, e-mail: users-help_at_jersey.dev.java.net
>