You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by cogitate <mo...@gmail.com> on 2011/04/28 19:42:39 UTC

CXF with HATEOS or hypermedia

We are fully invested in CXF for supporting payloads of various types - not
just Webservices but also RESTful services. However , for RESTful services
we want to have "hypermedia" support. 

Currently it seems CXF isn't supporting this and we are under pressure to go
to "Jersey" - however, i wouldn't want to throw our CXF code out. 

what's the way out?
design principles or information on any future support for Hypermedia would
be appreciated.


regards

--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-with-HATEOS-or-hypermedia-tp4347138p4347138.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF with HATEOS or hypermedia

Posted by Benson Margulies <bi...@gmail.com>.
CXF does not have a HATEOS framework. It  just provides the raw
materials. If you'd like to contribute one, we're all ears, but there
isn't one there now.


On Thu, Apr 28, 2011 at 1:42 PM, cogitate <mo...@gmail.com> wrote:
> We are fully invested in CXF for supporting payloads of various types - not
> just Webservices but also RESTful services. However , for RESTful services
> we want to have "hypermedia" support.
>
> Currently it seems CXF isn't supporting this and we are under pressure to go
> to "Jersey" - however, i wouldn't want to throw our CXF code out.
>
> what's the way out?
> design principles or information on any future support for Hypermedia would
> be appreciated.
>
>
> regards
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/CXF-with-HATEOS-or-hypermedia-tp4347138p4347138.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>

RE: CXF with HATEOS or hypermedia

Posted by "KARR, DAVID (ATTSI)" <dk...@att.com>.
> -----Original Message-----
> From: cogitate [mailto:monish.unni@gmail.com]
> Sent: Thursday, April 28, 2011 10:43 AM
> To: users@cxf.apache.org
> Subject: CXF with HATEOS or hypermedia
> 
> We are fully invested in CXF for supporting payloads of various types -
> not
> just Webservices but also RESTful services. However , for RESTful
> services
> we want to have "hypermedia" support.
> 
> Currently it seems CXF isn't supporting this and we are under pressure
> to go
> to "Jersey" - however, i wouldn't want to throw our CXF code out.
> 
> what's the way out?
> design principles or information on any future support for Hypermedia
> would
> be appreciated.

HATEOAS (not HATEOS) is a simple concept.  You don't need Jersey to use HATEOAS.  If you use the UriBuilder you can construct URLs that point to controller methods.  You can then populate responses with that data.

Jersey may provide more complete features (I've been seeing something about "linking"), but HATEOAS is what you make of it.

Re: CXF with HATEOS or hypermedia

Posted by Sergey Beryozkin <sb...@gmail.com>.
Actually, CXF JAX-RS proxies help in some way. JAX-RS subresources
help with modeling the transition from root resources to subresources.
On the client side, every call to a subresource method results in
returning a proxy too, etc.
Perhaps that is not what you're looking for but I thought i'd mention
it anyway...

Sergey

On Sun, May 1, 2011 at 6:27 PM, Sergey Beryozkin <sb...@gmail.com> wrote:
> Hi
>>> hi sergei :
>>>>  i am thinking more in terms of
>>>> 1. RESTfulie =>
>>>>    https://github.com/caelum/restfulie
>>>>    http://restfulie.caelum.com.br/
>>>>   yes which basically supports "links" with every entity or model.
>>>>
>>>
>>> Can you elaborate a bit more about your requirements ?
>>> Is it about the client runtime following the links ? Is it about
>>> making sure links are added at the moment resource representations are
>>> returned ?
>>>
>>> thanks, Sergey
>>>
>>
>> yes - having client runtime follow links. as well as server side producing
>> appropriate links for a resource. it should be possible to have this with
>> some kind of annotation/configuration support.
>> the key is how to seamlessly integrate this with "controllers/entities" w/o
>> polluting them with "resource links".
>>
>> Restfulie has a way to do that but miss some of the powerful features of CXF
>> like interceptors for outgoing and incoming messages of any type is missing.
>>
>> here's what restfulie has :
>> so let's say a basket controller has a list method that supports items
>> each controller constructs a "Restfulie restfulie" object and a "Result
>> result" object and relations for a
>> resource akin to code below.
>>
>>  @Get
>>  @Path("/items")
>>  public void list() {
>>    ConfigurableHypermediaResource resource =
>> restfulie.enhance(database.list());
>>    resource.relation("basket").uses(BasketsController.class).create(null);
>>      result.use(representation()).from(resource, "items").serialize();
>>  }
>>
>> this gets translated as when items are returned - i use the particular
>> hypermedia resource to give links out and represent them to my result.
>
> The way Restfulie ebhances the representations looks interesting indeed...
> I'm not sure how CXF can help  Restfulie as it looks like it provides
> a pretty powerful 'api' for working with links on its own, please,
> elaborate on it when you get a chance.
>
> As far as consuming links is concerned, CXF only offers XMLSource
> helper for retrieving all sorts of custom links  via XPath
> expressions. That is more or less a generic solution - the only thing
> which is different per every case is XPath value.
>
> CXF does not provide a helper which would say start from a top
> resource and guide the client code to the very last one.
> That can be quite an interesting area to look into. Thoughts/ideas are
> welcome - may be I need to understand how Restfulie works in order to
> get some ideas on how to offer some generic helper.
>
> Cheers, Sergey
>
>>
>> restfulie also provides nice wrapper methods around http header return
>> values like "404 NOT found" is represented w/  "return result.notFound()"
>>
>> regards
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://cxf.547215.n5.nabble.com/CXF-with-HATEOS-or-hypermedia-tp4347138p4361446.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>
>
>
> --
> Sergey Beryozkin
>
> Application Integration Division of Talend
> http://sberyozkin.blogspot.com
>

Re: CXF with HATEOS or hypermedia

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
>> hi sergei :
>>>  i am thinking more in terms of
>>> 1. RESTfulie =>
>>>    https://github.com/caelum/restfulie
>>>    http://restfulie.caelum.com.br/
>>>   yes which basically supports "links" with every entity or model.
>>>
>>
>> Can you elaborate a bit more about your requirements ?
>> Is it about the client runtime following the links ? Is it about
>> making sure links are added at the moment resource representations are
>> returned ?
>>
>> thanks, Sergey
>>
>
> yes - having client runtime follow links. as well as server side producing
> appropriate links for a resource. it should be possible to have this with
> some kind of annotation/configuration support.
> the key is how to seamlessly integrate this with "controllers/entities" w/o
> polluting them with "resource links".
>
> Restfulie has a way to do that but miss some of the powerful features of CXF
> like interceptors for outgoing and incoming messages of any type is missing.
>
> here's what restfulie has :
> so let's say a basket controller has a list method that supports items
> each controller constructs a "Restfulie restfulie" object and a "Result
> result" object and relations for a
> resource akin to code below.
>
>  @Get
>  @Path("/items")
>  public void list() {
>    ConfigurableHypermediaResource resource =
> restfulie.enhance(database.list());
>    resource.relation("basket").uses(BasketsController.class).create(null);
>      result.use(representation()).from(resource, "items").serialize();
>  }
>
> this gets translated as when items are returned - i use the particular
> hypermedia resource to give links out and represent them to my result.

The way Restfulie ebhances the representations looks interesting indeed...
I'm not sure how CXF can help  Restfulie as it looks like it provides
a pretty powerful 'api' for working with links on its own, please,
elaborate on it when you get a chance.

As far as consuming links is concerned, CXF only offers XMLSource
helper for retrieving all sorts of custom links  via XPath
expressions. That is more or less a generic solution - the only thing
which is different per every case is XPath value.

CXF does not provide a helper which would say start from a top
resource and guide the client code to the very last one.
That can be quite an interesting area to look into. Thoughts/ideas are
welcome - may be I need to understand how Restfulie works in order to
get some ideas on how to offer some generic helper.

Cheers, Sergey

>
> restfulie also provides nice wrapper methods around http header return
> values like "404 NOT found" is represented w/  "return result.notFound()"
>
> regards
>
>
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/CXF-with-HATEOS-or-hypermedia-tp4347138p4361446.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Re: CXF with HATEOS or hypermedia

Posted by cogitate <mo...@gmail.com>.

Sergey Beryozkin-5 wrote:
> 
> Hi
> 
> On Fri, Apr 29, 2011 at 12:07 AM, cogitate &lt;monish.unni@gmail.com&gt;
> wrote:
>> hi sergei :
>>  i am thinking more in terms of
>> 1. RESTfulie =>
>>    https://github.com/caelum/restfulie
>>    http://restfulie.caelum.com.br/
>>   yes which basically supports "links" with every entity or model.
>>
> 
> Can you elaborate a bit more about your requirements ?
> Is it about the client runtime following the links ? Is it about
> making sure links are added at the moment resource representations are
> returned ?
> 
> thanks, Sergey
> 

yes - having client runtime follow links. as well as server side producing
appropriate links for a resource. it should be possible to have this with
some kind of annotation/configuration support. 
the key is how to seamlessly integrate this with "controllers/entities" w/o
polluting them with "resource links".

Restfulie has a way to do that but miss some of the powerful features of CXF
like interceptors for outgoing and incoming messages of any type is missing.

here's what restfulie has :
so let's say a basket controller has a list method that supports items
each controller constructs a "Restfulie restfulie" object and a "Result
result" object and relations for a 
resource akin to code below. 

  @Get
 @Path("/items")
 public void list() {
    ConfigurableHypermediaResource resource =
restfulie.enhance(database.list());
    resource.relation("basket").uses(BasketsController.class).create(null);
      result.use(representation()).from(resource, "items").serialize();
  }

this gets translated as when items are returned - i use the particular
hypermedia resource to give links out and represent them to my result.

restfulie also provides nice wrapper methods around http header return
values like "404 NOT found" is represented w/  "return result.notFound()" 

regards






--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-with-HATEOS-or-hypermedia-tp4347138p4361446.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF with HATEOS or hypermedia

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

On Fri, Apr 29, 2011 at 12:07 AM, cogitate <mo...@gmail.com> wrote:
> hi sergei :
>  i am thinking more in terms of
> 1. RESTfulie =>
>    https://github.com/caelum/restfulie
>    http://restfulie.caelum.com.br/
>   yes which basically supports "links" with every entity or model.
>

Can you elaborate a bit more about your requirements ?
Is it about the client runtime following the links ? Is it about
making sure links are added at the moment resource representations are
returned ?

thanks, Sergey

> 2. Jersey =>
>  the support here is a bit more sophisticated , supports "Links" using
> header.
>
> i will look into urlbuilder to support hypermedia.
> regards
> --
> View this message in context: http://cxf.547215.n5.nabble.com/CXF-with-HATEOS-or-hypermedia-tp4347138p4357394.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>

Re: CXF with HATEOS or hypermedia

Posted by cogitate <mo...@gmail.com>.
hi sergei :
 i am thinking more in terms of 
1. RESTfulie => 
    https://github.com/caelum/restfulie
    http://restfulie.caelum.com.br/
   yes which basically supports "links" with every entity or model.

2. Jersey => 
  the support here is a bit more sophisticated , supports "Links" using
header.

i will look into urlbuilder to support hypermedia.
regards
--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-with-HATEOS-or-hypermedia-tp4347138p4357394.html
Sent from the cxf-user mailing list archive at Nabble.com.