jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: [jax-rs-spec users] Re: Link header can contain more than one link

From: Bill Burke <bburke_at_redhat.com>
Date: Tue, 03 Jul 2012 12:57:24 -0400

On 7/3/12 11:03 AM, Santiago Pericas-Geertsen wrote:
>
> On Jul 2, 2012, at 5:50 PM, Bill Burke wrote:
>
>>
>>
>> On 7/2/12 5:48 PM, Julian Reschke wrote:
>>> On 2012-07-02 23:44, Bill Burke wrote:
>>>>
>>>>
>>>> On 7/2/12 5:38 PM, Julian Reschke wrote:
>>>>> On 2012-07-02 23:17, Bill Burke wrote:
>>>>>> A Link header can contain more than one link within it delimited by a
>>>>>> ','
>>>>>>
>>>>>> Does this conflict with Link header delegate we're supposed to provide
>>>>>> as an implementor? Current implemntation of Link class pretty much
>>>>>> assumes one link per string value.
>>>>>
>>>>> Well, there can also be multiple instances of the header field. Both
>>>>> should be treated the same way, right?
>>>>>
>>>> I know Tomcat, Jetty, jBossWeb do not auto separate comma-delimited
>>>> headers and assumed jaxrs implementations shouldn't either.
>>>
>>> They can't, unless they know the exact syntax of the header field.
>>>
>>
>> ...which brings me back to my original point that our Link HeaderDelegate can only support 1 link string.
>
> Yes, that's true. Do we really want to change this? Seems like unnecessary complexity given that you can have multiple instances.
>

I don't know...Link is a special case and can't be handled by the
HeaderDelegate directly.

Consider this header:

Link: <http:...>; rel="edit", <http:...>; rel="next";


void foo(@HeaderParam("Link") String links,
          @HeaderParam("Link") Link[] links)

In Resteasy we have a LinkHeader class that represents one HTTP Link
header. LInkHeader serves up multiple Link objects. Its a very literal
interpretation of things. Our ClientResponse has a getLink(String rel)
method, but on the server side, users inject a LinkHeader object.

Maybe what exists in the spec is simpler and we should handle the split
of comma delimited things internally? I don't know...


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