users@jersey.java.net

RE: [Jersey] What HATEOAS actually means

From: Markus Karg <markus.karg_at_gmx.net>
Date: Mon, 15 Feb 2010 22:03:11 +0100

> As for entities - I don't see how you could go by without a plugin
> mechanism of some sort (like you need message body readers/writers).

Just what I say. :-)

> I am not sure a generic approach is feasible because hypermedia can
> take many forms
>
> - links
> - link templates
> - forms
> - exotic (as in http://www.nordsc.com/blog/?p=293#cbcID-tweak )

I also think that it makes no sense. Once more, I need to come back to the
dissertation: It contains the example of HTML and <A>. If you want to do
that with JAX-RS 1.1 it is pretty simple -- just add <A> anywhere in the
HTML. How would you support that in a generic way? This would be very
complex (how to tell *where* the <A> shall be located?) or you would just
add a list of <A> at the end. If you reduce to that link list, the API is
simple: ...entity(x).add(URI); will result in <A href="uri"/> which is 100%
correct HATEOAS and will work with all forms of URIs. As you did not say
that you MUST use forms, it cannot be a fault to not use them but to stick
with <A> always. So if you go from HTML to PDF, that format also allows you
to have links at the end (possibly on it's own page). Also XML allows you to
have XLinks added (as long as the XSD allows it). I don't know about JSON,
but I'm rather sure it can handle an added list of URIs... ;-)