I see your point and it's better than nothing. But from the user's view it
just makes things more complex and less intuitive. It smells like sewing a
pathwork, not like providing a streamlined RESTful soltion. As I said,
JAX-RS has a design fault in my opinion, as it separates entities from
resources, and we have to live with that. But we should not enlarge that gap
with strange workarounds like fromResource. See, JAX-RS more and more tends
to look like a functions framework where people expect objects. We should
give them objects. @Linkable marks an object. fromResource is a function. I
hope you see my point?
From: Santiago Pericas-Geertsen [mailto:Santiago.PericasGeertsen_at_oracle.com]
Sent: Freitag, 4. November 2011 21:43
To: jsr339-experts_at_jax-rs-spec.java.net
Subject: [jsr339-experts] Re: [jax-rs-spec users] Re: Re: Improving
Hypermedia Support
Markus,
* @Linkable is much more conventient as it induces an automatism to the self
URI, what does not necessarily mean that fromResourceMethod is obsolete --
why not give the user *both* possibilities? A complete different idea would
be the way we currently implement it in our solutions: Providing a map from
entity to "root" URI (what I would not prefer if there would be @Linkable).
As I said, I'd prefer something that is not completely declarative at this
point. What if we define Link.fromResource(Class<?> c) without a method name
parameter, and mark a method with @Rel(SELF) where SELF is the constant
"self" (to avoid introducing a new annotation). See section in wiki [1].
-- Santiago
[1]
http://java.net/projects/jax-rs-spec/pages/HypermediaExample