users@jersey.java.net

Re: [Jersey] Request.evaluatePreconditions and If-None-Match:*

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 20 Jan 2009 10:59:34 +0100

On Jan 20, 2009, at 2:25 AM, Gili wrote:

>
> I hope I didn't jump the gun, but upon taking at the Jersey source-
> code I
> don't think it is technically possible to get this to work. I filed
> https://jersey.dev.java.net/issues/show_bug.cgi?id=185 but I believe
> this is
> actually a bug in the specification. It's my understanding that Marc
> Hadley
> reads this mailing list so hopefully he will run across this post.
>

Yes, i think this is an oversight in the spec.

So what you are proposing is if a null value for an entity tag is
passed in then the application is stating the resource does not exist.
And a null value will be returned for the case of If-None-Match: * is
present.

We may be able to resolve in the maintenance release, but i need to
discuss with Marc.

A workaround is to do the following:

  public void put (...., @HeaderParam("If-None-Match") String value) {
      if (value.equals("*") {
      } else {
      }
  }

Paul.

> Gili
>
>
> Gili wrote:
>>
>> Hi,
>>
>> My client issues an HTTP PUT with If-None-Match: * because it
>> wishes to
>> ensure the operation only proceeds if the resource does not already
>> exist.
>> I'm not sure how to implement this using
>> Request.evaluatePreconditions on
>> the server side. I want to be able to support both If-None-Match and
>> If-Match headers on the server.
>>
>> If the resource doesn't exist then I can't invoke
>> Request.evaluatePreconditions(EntityTag) because I have no
>> EntityTag. If I
>> omit this call altogether but the client specifies If-Match:
>> <value> then
>> I will fail to handle this header and the call with go ahead even
>> though
>> it should not. Any ideas?
>>
>> Thank you,
>> Gili
>>
>
> --
> View this message in context: http://n2.nabble.com/Request.evaluatePreconditions-and-If-None-Match%3A*-tp2184385p2184454.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>