[jax-rs-spec users] [jsr339-experts] Re: Link default behavior doing 'too much'

From: Santiago Pericas-Geertsen <>
Date: Mon, 5 Nov 2012 10:09:10 -0500

On Nov 3, 2012, at 6:29 PM, Jan Algermissen <> wrote:

> - The idea to set the 'type' parameter per default makes the default
> toString() behavior emphasize a bad-practice. (Putting in type
> information might seem like a good idea to most people, but it really
> is against the idea that REST focusses on deferring such information
> to the actual request/response.)
> I think we should have another method besides toString() for generating
> link header values that include 'type' and make toString() exhibit
> 'correct' behavior.
> - Using 'type' information as the source for setting 'Accept' when
> calling Invocation.Builder#invocation(Link) is also something that
> leads away from RESTful design more than it leads towards it.
> Clients set 'Accept' based on *their* intentions and capabilities.
> That is, for example, why Browsers set 'Accept: image/*" or similar
> when following an <img src=""> link and what that link does not and does
> not need to provide any information about the media type of the image.

 I just don't see how adding more semantic information to links makes things less "runtime". It doesn't change in any way the content negotiation that takes place when the link is followed. Most of the feedback around Link, and how developers use it in practice, is the opposite: they want more not less information. This reminds me of one of my favorite quotes: "The difference between theory and practice is greater in practice than in theory."

 There's always Link.fromUri(URI) if the default behavior does not suit your needs.

-- Santiago