jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: Hypermedia - Take 2

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Sat, 23 Jul 2011 23:35:58 +0100

>
>
> * Transitional Links:
>
>
>
> I do not see the need for two new annotations. It seems to be rather
> complex. The provision of the links could be done simply by means of
> builder API in terms of Java (like "Response…links(Collection<Link>))
> which is easy to read and to debug. I do not see what actual benefit the
> annotations will bring, also I do not see why we should insist on people
> writing explicit link builder methods (they just can create links
> inlined if they)?
>

I found the example showing Transitional Links rather complex - so I
think I agree with the above statement - so far I do not understand the
benefits - perhaps more examples can be provided at the wiki ?

>
>
> * Structural Links:
>
>
>
> If order contains items (<order><item/><item/><item/></order>, e. g.
> class @XmlElement Order { private List<Item> items; }, then it is rather
> simple to turn this into XML links by using one single annotation:
>
>
>
> @XmlElement Order { @Ref private List<Item> items; }
>
>
>
> where @Ref is nothing but providing some sugar around an Xml Java Type
> Adapter replacing Item by URI and vice versa on the fly at marshalling /
> unmarshalling. This is the most typical use case for structural links
> from my experience (using this for months now and works pretty good) and
> in fact this is what I expect to make most users happy in the first
> draft. BTW, I personally would be more fluent and not name it @Ref but
> @Externalize (like it is "@Inject" to have a verb what the processor
> does) -- "externalize" since this is what the sugar will do: It replaces
> the Java "internal" link by an "external" URL representation. The "only"
> question is what to do with those not using JAXB? (Actually, how many
> are not using JAXB actually?)
>
>
Sorry - would really appreciate some more information at the wiki page.
I did follow the links there and read the Declarative Hyperlinking in
Jersey page and yes, it was interesting but I thought a bit too involved
and this is what I expressed in the other email.

At the moment it's more like a conversation of Jersey users - I just
don't follow what is being discussed.

Personally, I like the idea of introducing Linkable interface as well.
I believe Jersey does try to offer a lot of flexibility - but I'm not
sure, unless I see more or less realistic examples at the wiki, that all
  of that needs to be supported in 2.0. Explicit EL links to specific
representation and/or entity methods seems brittle and a bit complex.
Things can be changing all the time and updating the EL expressions
seems unavoidable. Linkable interface would 'protect' @Ref/_at_Externalize
annotations from being regularly updated

Sergey

>
> Regards
>
> Markus
>
>
>
> *From:* Santiago Pericas-Geertsen
> [mailto:Santiago.PericasGeertsen_at_oracle.com]
> *Sent:* Mittwoch, 20. Juli 2011 20:08
> *To:* jsr339-experts_at_jax-rs-spec.java.net
> *Subject:* [jsr339-experts] Hypermedia - Take 2
>
>
>
> Hi Experts,
>
>
>
> The wiki page on Hypermedia / HATEOAS has been updated after processing
> all the feedback received on the declarative hyperlinking approach and
> related topics.
>
>
>
> After going through all the e-mail threads, I now believe it would be
> useful to divide the hyperlinking problem into two parts: structural
> links and transitional links (I came up with these terms, feel free to
> dislike them :). See [1] for a discussion.
>
>
>
> It appears that supporting transitional links is easier, and a simple,
> non-declarative (annotation free) approach is described in [1]. Note
> that transitional links are handled completely at the resource
> (controller) level and are conveyed as Link Headers (my personal
> preference). Support in the Client API is also straightforward (and
> similar to Restfulie).
>
>
>
> Structural links are more complex to support given their interaction
> with other parts of the system (readers, writers, JAXB, etc), and given
> their impact on the model. A declarative, annotation-based approach may
> be the way to go, but there are a number of issues that need to be
> sorted out.
>
>
>
> In summary, [1] is an incomplete story, but wanted to direct your
> attention to the new content to help us drive future discussions.
>
>
>
> -- Santiago
>
>
>
> [1] http://java.net/projects/jax-rs-spec/pages/Hypermedia
>

-- 
Sergey Beryozkin
http://sberyozkin.blogspot.com
Talend - http://www.talend.com