[jax-rs-spec users] Re: Hypermedia API

From: Bill Burke <>
Date: Wed, 17 Dec 2014 10:01:27 -0500

On 12/17/2014 9:28 AM, Markus KARG wrote:
> Yes, this solution can be done in an interceptor, as I already told Santiago
> today. The proposal is _not_ to include any particular MBW / MBW but solely
> the definition of the @StructuralLink annotation and the lookup-Methods. It
> is up to any author of MBW / MBR authors, and / or up to any author of
> Interceptors, to use them or not.

as for the lookup methods some dispatch/forward method like we have in
servlet spec would be interesting. This would be unrelated to your
proposal though.

> About the missing metadata can you please elaborate what you think is
> missing hence imposes a need to "guess"?

The container has to guess how to resolve B in your example because you
have not provided the resource class and method name that contains the
@Path that resolves B.

> About the necessarity of this API: Better support for hypermedia is a static
> item on the JSR 370 charter. Hypermedia is about structural links and
> transitional links. My proposal was announced as an example how structural
> links could be supported in future, IF THIS IS WANTED. If you ask me: Build
> it and they will come. My experience is that people did not use it in the
> past, because it was not there. It was there in your product, but it was not
> there in the standard. And many people are reluctant with non-standard
> features.

This is an untrue statement. Users will use proprietary vendor-specific
JAX-RS extensions. Before JAX-RS 2.0 our interceptor model was widely
used. Our client proxy support (added like 5 years ago) is probably our
most popular feature even to this day. Our linking extension? Well,
again, not many questions on it so I assume it is not popular.

> About building links by hand: This is only possible if the application
> vendor and the MBW author are the same.

Not sure why that is important. So what if the vendor and MBW author
are not the same?

> But -at least- in my case, these are

This is my biggest concern. That this is specific to your use case.

> So the question is: Do we want to support structural links, yes or no? If
> the answer is yes and my proposal doesn't fulfil all needs, the question is
> who proposes an alternative? And if the answer is no then the question is
> why asking me for a proposal in the end? ;-)

You just want to add the annotation and the lookup methods but require
nothing else. While some form of lookup methods would be a nice add to
the spec (see above), I don't see the point in adding the annotation if
we're not going to add a facility to automatically build (or even
expand) links.

Looking at your MBW example again, I don't see why you need a specific
method for Link lookup. Can't you just use UriBuilder?

Bill Burke
JBoss, a division of Red Hat