users@jersey.java.net

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

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 20 Jan 2009 14:27:47 -0500

On Jan 20, 2009, at 7:22 AM, Gili wrote:

>
> Alternatively, simply add Request.evaluatePreconditions()
> with no
> arguments that would indicate that the resource does not exist. This
> would be backwards compatible.
>
I think adding a new method as you suggest would be best. I'll add
this to the list of proposed changes for JAX-RS 1.1.

Marc.

>
> Paul Sandoz (via Nabble) wrote:
>
> >
> > 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@...
> > <http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2185767&i=0>
> > > For additional commands, e-mail: users-help@...
> > <http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2185767&i=1>
> > >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@...
> > <http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2185767&i=2>
> > For additional commands, e-mail: users-help@...
> > <http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2185767&i=3>
> >
> >
> >
> >
> ------------------------------------------------------------------------
> > This email is a reply to your post @
> > http://n2.nabble.com/Request.evaluatePreconditions-and-If-None-Match%3A*-tp2184385p2185767.html
> > You can reply by email or by visting the link above.
> >
>
> View this message in context: Re: [Jersey]
> Request.evaluatePreconditions and If-None-Match:*
> Sent from the Jersey mailing list archive at Nabble.com.

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.