users@jax-rs-spec.java.net

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

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Thu, 5 Jul 2012 10:26:56 -0400

On Jul 3, 2012, at 12:57 PM, Bill Burke wrote:

>
>
> 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...

 This sounds like a reasonable suggestion to me. My take on this is that the use of "," would be the exception rather than the rule.

-- Santiago