users@jersey.java.net

Re: [Jersey] RESTful Ordering (was: JAX-RS == REST? Or not? (was Re: [Jersey] What HATEOAS actually means))

From: Kevin Duffey <andjarnic_at_yahoo.com>
Date: Fri, 19 Feb 2010 10:08:08 -0800 (PST)

I am thinking the same as Santiago here. It seems in some cases, being pure REST is not the way to go, and as Roy and others have said in some comments on forum posts and here on this list... REST is not always the right architecture. It's a shame tho, and hence why I've said a few times, and I notice on the rest-discuss list a few others too have said.. what we need then is a HTTP api (I think you coined that Jan).. something that we can get "buy in" from the developer community at large, regardless of language/platform, that is mostly RESTful, in that it uses HTTP (or perhaps not tied to HTTP), the methods, and we can basically use it in place of xml-rpc/web services. It's much easier to work with and with so many now doing it like this anyway (due to not being completely RESTful), perhaps we look at some way to make a cousin to REST that can take off and become a newer/better API choice over web services and being pure REST.

That said, I can see how REST could be used for the cart example... but (always a but) I am failing to see how anyone other than an individual client would want to use a pure rest implementation since the burden of maintaining state is put on them. By anyone other than individual, I basically mean a web site... where they cater to end users.. and thus have to deal with the scaling issues that maintaining state will put on them. It's the HttpSession/replication nightmare all over again.. although these days we're far better prepared to scale state than back in the late 90s when servlets and HttpSession were first being developed with and not many people had an idea how to replicate session data to ensure fault tolerance and load.



--- On Fri, 2/19/10, Santiago Pericas-Geertsen <Santiago.Pericasgeertsen_at_Sun.COM> wrote:

From: Santiago Pericas-Geertsen <Santiago.Pericasgeertsen_at_Sun.COM>
Subject: Re: [Jersey] RESTful Ordering (was: JAX-RS == REST? Or not? (was Re: [Jersey] What HATEOAS actually means))
To: users_at_jersey.dev.java.net
Date: Friday, February 19, 2010, 5:38 AM

Jan,

 If the meaning of the message must be completely independent of the server's state, then this makes perfect sense. I suppose that orders should include item prices and other information to avoid depending on any other server state.

 This is a much stronger constraint than session state independence, or simply a different interpretation of what I understood as a session. And it does appear to introduce some complexity for certain systems and may be the reason why many things out there are not REST in this sense.

 Thanks for the clarification.

-- Santiago

On Feb 19, 2010, at 2:52 AM, Jan Algermissen wrote:

> All,
>
> here is the issue with the POST on the shopping cart to place the order:
>
> REST constrains messages to be stateless. The meaning of the message must not depend on server side state.
>
> The meaning of the message depends on the semantics of the resource (which is constrained to be constant over time) but it must not depend on the resource's state at some point in time.
>
> This is why, in order to correctly reflect the intention to buy A,B and C (see earlier example[1]) these items must be enumerated in the POST body. Just POSTing to the cart resource makes the meaning of the message a function of the semantics of the resource BUT NOT of its current state.
>
> Jan
>
> [1] https://jersey.dev.java.net/servlets/ReadMsg?list=users&msgNo=10255
>
>
>
> On Feb 18, 2010, at 4:03 PM, Jan Algermissen wrote:
>
>>
>> On Feb 18, 2010, at 3:36 PM, Jan Algermissen wrote:
>>
>>>
>>> On Feb 18, 2010, at 3:32 PM, Jan Algermissen wrote:
>>>
>>>>
>>>>
>>>> for purposes of visibility but I just saw Mark B mentioning that and cannot give an explanation.
>>>>
>>>
>>> Here is the short thread: <http://tech.groups.yahoo.com/group/rest-discuss/message/13627>
>>
>> Re-reading that, there are two issues
>>
>> - I am not sure I agree and if I do I cannot completely explain on what grounds
>> - There indeed is an issue with how much the client wants to rely on the server
>> maintining stability of the cart (or order) when it comes to
>> me hitting 'submit'. IOW, how can I be sure the resource state is the same
>> when the POST arives as it was when I sent the request
>> - the issue has consequences on the design of e.g. the payment 'operation'
>> that started this thread.
>> Mark's position emphasizes that the complete order should be sent to a
>> payment resource instead of invoking a POST-tunneled pay() on the order.
>>
>> Jan
>>
>>>
>>>
>>>
>>>> Jan
>>>>
>>>>
>>>>> In my view, creating resources identifiers for things of interest is precisely how you avoid relying on sessions. The service will associate that resource identifier with objects stored in a database, and there's no need for the client to store anything once it gets that resource identifier.
>>>>>
>>>>> By analogy, let's say you call your insurance company to file a claim. The first time you call, you give them all your info and they give you a claim number (a resource identifier!). Next time you call, it does not really matter who you talk to as long as you give them the claim number and they can look it up in their database. Without a claim number, you'd need to start all over or talk to the same person to continue the session --and that wouldn't very RESTful.
>>>>>
>>>>> I'm not sure I can comment on your API specifically, but I believe you can build the system the way you want without relying on sessions.
>>>>>
>>>>> -- Santiago
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>>
>>>>
>>>> -----------------------------------
>>>> Jan Algermissen, Consultant
>>>> NORD Software Consulting
>>>>
>>>> Mail: algermissen_at_acm.org
>>>> Blog: http://www.nordsc.com/blog/
>>>> Work: http://www.nordsc.com/
>>>> -----------------------------------
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>
>>>
>>> -----------------------------------
>>> Jan Algermissen, Consultant
>>> NORD Software Consulting
>>>
>>> Mail: algermissen_at_acm.org
>>> Blog: http://www.nordsc.com/blog/
>>> Work: http://www.nordsc.com/
>>> -----------------------------------
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>
>> -----------------------------------
>> Jan Algermissen, Consultant
>> NORD Software Consulting
>>
>> Mail: algermissen_at_acm.org
>> Blog: http://www.nordsc.com/blog/
>> Work: http://www.nordsc.com/
>> -----------------------------------
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
> -----------------------------------
> Jan Algermissen, Consultant
> NORD Software Consulting
>
> Mail: algermissen_at_acm.org
> Blog: http://www.nordsc.com/blog/
> Work: http://www.nordsc.com/
> -----------------------------------
>
>
>
>
>
> ---------------------------------------------------------------------
> 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