users@jersey.java.net

Re: [Jersey] Jersey's (experimental) approach to support hypermedia constraint

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 11 Feb 2010 11:32:01 +0100

On Feb 11, 2010, at 11:01 AM, Jan Algermissen wrote:

>
> On Feb 11, 2010, at 10:01 AM, Paul Sandoz wrote:
>
>>
>> On Feb 10, 2010, at 11:26 PM, Jan Algermissen wrote:
>>
>>>
>>> On Feb 10, 2010, at 10:31 PM, Paul Sandoz wrote:
>>>
>>>>> (But then, I find the whole aproach to hypermedia confusing
>>>>> (sorry)).
>>>>>
>>>>
>>>>
>>>> I think in essence hypermedia is very elegant and once grasped
>>>> surprisingly simple, but gosh it can take time to get your brain
>>>> thinking the right way about it, well it did for me :-)
>>>
>>>
>>> :-) I meant that I find the *Jersey approach* confusing!
>>>
>>
>> As i suggested, if you have time, try playing with the example a
>> bit :-)
>
> Yep, just doing that.
>
> Question: how are the return codes handled? E.g. upon POST /order/1/
> review
>
> 200 ok -> request succeeded with content - how s that content handled?
> 204 No Content -> easy: request succeeded

Currently assumes one of the above two based on the return type of the
interface method.

 From the ControllerInvocationHandler code, line 233

         // Update local model if returned
         HypermediaController hc =
ctrlClass.getAnnotation(HypermediaController.class);
         assert hc != null;
         if (method.getReturnType() == hc.model()) {
             model = (T) response.getEntity(modelClass);
             response.close();
             return model;
         } else if (method.getReturnType() != void.class) {
             Object tmp = response.getEntity(method.getReturnType());
             response.close();
             return tmp;
         } else {
             return null;
         }


> 205 Reset Content -> any significance to this one or just handled
> like 204?
> 201 Created -> How does the framework react upon newly created
> resource?
> Can I configure the client to proceed to GET the Location URI?
> 202 Accepted -> (I find this to be the most likely one) How does the
> framework support the subsequent polling to check if request has
> actually been processed
> 303 See Other -> Common pattern would be that the server uses this
> code to
> redirect the client to the updated order. Is there support for
> this?
>

All to be determined. Lots of stuff to work out :-)

Santiago enumerated a list of TODOs and we can add to this list:

   http://wikis.sun.com/display/Jersey/Hypermedia+TODOs

Paul.