users@jsr311.java.net

Re: Supporting Link: header?

From: Bill Burke <bburke_at_redhat.com>
Date: Wed, 19 Aug 2009 09:05:54 -0400

Marc Hadley wrote:
> On Aug 4, 2009, at 2:02 AM, Michael Hausenblas wrote:
>>
>> When reading the Appendix B of v1.1 of the Editors Draft of JAX-RS, I was
>> wondering if there is *any* chance that the Link: header will be
>> supported
>> as well (pls. forgive me if this has been discussed already - failed
>> to find
>> it in the ML archive). Point is that we are implementing a LRDD-based
>> service [1] and would be willing to switch to JAX-RS, given this
>> header is
>> supported.
>>
>> Let me ensure you that I'm very happy to see your great work re a
>> Java/REST
>> interface happening; eventually a real alternative to RoR, etc.
>>
> While there isn't currently a specific method in ResponseBuilder for the
> Link header, its still easy to support using:
>
> ResponseBuilder.header("Link", headerValue)
>
> where headerValue is an instance of any class whose toString method
> produces a suitable string value for the header.
>
> Its probably a little early in the life of the Link header (its still an
> IETF working draft) to bake anything specific for it into the API: if
> the draft changes significantly then backwards compatibility
> requirements on the API could make it awkward to evolve the API.
>

I actually really like the Link header. As Marc says though, its pretty
easy to write a header delegate or toString/valueOf combos to make it
work with .header().

I do see a Link header specific API becoming important within any Client
framework JAX-RS 2.0 comes up with. Its a real pain to work with Link
headers otherwise.

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com