users@jax-rs-spec.java.net

[jax-rs-spec users] Re: Other representations of links?

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Tue, 19 Feb 2013 09:22:26 -0500

Jan,

 If you use a Link as a header (via ResponseBuilder), then it is assumed to be RFC 5988 and serialized as such. If you use a Link as part of your data model then you may have other options; we provide a simple JAXB adapter that can be used to serialize a link when using JAXB (see Link.JaxbAdapter).

 I don't believe there was any discussion of an extensible serialization mechanism for links beyond this.

-- Santiago

On Feb 19, 2013, at 7:23 AM, Jan Kronquist <jan.kronquist_at_jayway.com> wrote:

> The Link javadocs contains:
>
> * <p>The methods {_at_link #toString} and {_at_link #valueOf} can be used to serialize and de-serialize a link into a link header (RFC 5988).</p>
>
> Is it possible to generate other representations? Or should the Link only be used in the RFC 5988 link header?
>
> For example create a MessageBodyWriter that generates HTML and puts the links in the HTML header? How would I do this?
>
> My current guess would be a WriterInterceptor that reads the link header (possibly removing it) and somehow adds it to the entity.
>
> /Jan