users@jersey.java.net

Re: [Jersey] Hypermedia Support is useless

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Mon, 15 Feb 2010 09:12:48 -0500

On Feb 15, 2010, at 7:33 AM, Jan Algermissen wrote:

>>
>> Consider the following renaming:
>>
>> @POST
>> @TransitionTo("reviewed") @Path("reviewed")
>> public void review(@FormParam("reviewer") String reviewer) {
>> // Store the reviewer for auditing purposes
>> order.setStatus(REVIEWED);
>> }
>>
>> And a client proxy:
>>
>> @TransitionTo("reviewed")
>> public void transitionToReviewed(@Name("reviewer") String s);
>>
>> The client proxy understands the link relation "reviewed" and thus knows what HTTP method to use and what representation to send.
>>
>
> What is wrong about
>
> 412 Precondition Failed
>
> causing the client to reload and 'see' that the status has changed?
>
I don't see how 412 is appropriate, that status indicates that:

"The precondition given in one or more of the request-header fields evaluated to false when it was tested on the server. This response code allows the client to place preconditions on the current resource metainformation (header field data) and thus prevent the requested method from being applied to a resource other than the one intended."

I suppose the client could be using optimistic concurrency to ensure the order hasn't been reviewed by somebody else already but that seems orthogonal to the main thrust of this discussion.

Marc.