users@jersey.java.net

[Jersey] Re: ReST question

From: Jason Lee <jason.d.lee_at_oracle.com>
Date: Mon, 06 Feb 2012 11:36:41 -0600

You might look at the Hypermedia examples in the Jersey docs. They deal
with workflow situations that seem to be similar to yours:

http://jersey.java.net/nonav/documentation/latest/user-guide.html#hypermedia

On 2/6/12 10:22 AM, Noah White wrote:
> This is more of a general ReST question then Jersey specific but I am implementing things with Jersey so I thought I'd post it. Let's say I have 3 objects
>
> Class Foo
> Class Bar
> Class Baz
>
> and I want the workflow involving the three to look like so:
>
> Update property A on Foo to some new value
> Delete Bar if a Bar
> Update a property on Baz
>
> One approach I have seen taken in similar circumstances is something like so:
>
> PUT some new value to /resource/foos/{id}/property
> which Redirects to a DELETE /resource/bars/{id}
> which Redirects to a PUT some new value to /resource/bazs/{id}
>
> The problem I have is that I need the workflow to occur in a single transaction. I could easily do something like:
>
> PUT some new value /actions/reset/foos/{id}/propery
>
> And have that endpoint handle the entire workflow in 1 TX but that's more RPCish behavior then ReST like.
>
> Thoughts? Thnx,
>
> -Noah
>


-- 
Jason Lee
Senior Member of Technical Staff
GlassFish Team
Oracle Corporation
Phone +1 405-216-3193
Blog http://blogs.steeplesoft.com