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

[jsr339-experts] Re: [jax-rs-spec users] Re: Resetting parameters after LinkBuilder#uri

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Tue, 26 Mar 2013 09:58:23 +0300

On 25/03/13 22:42, Marek Potociar wrote:
>
> On Mar 25, 2013, at 8:24 PM, Sergey Beryozkin<sberyozkin_at_talend.com> wrote:
>
>> On 25/03/13 21:58, Marek Potociar wrote:
>>> On Mar 25, 2013, at 3:24 PM, Bill Burke<bburke_at_redhat.com> wrote:
>>>
>>>>
>>>>
>>>> On 3/25/2013 9:50 AM, Sergey Beryozkin wrote:
>>>>> On 25/03/13 16:46, Bill Burke wrote:
>>>>>>
>>>>>>
>>>>>> On 3/25/2013 9:34 AM, Sergey Beryozkin wrote:
>>>>>>> Hi
>>>>>>>
>>>>>>> Should be LinkBuilder#uri documented to clarify that the parameters have
>>>>>>> to be reset ?
>>>>>>>
>>>>>>> CXF user reported a different issue but it highlighted that when a link
>>>>>>> builder is reused, the new Link will have the parameters inherited from
>>>>>>> the previous link, for example,
>>>>>>>
>>>>>>> linkBuilder.uri("/next").rel("next").param("a", "a1");
>>>>>>> Link next = linkBuilder.build();
>>>>>>>
>>>>>>> linkBuilder.uri("/prev").rel("prev").param("b", "b1");
>>>>>>> Link prev = linkBuilder.build();
>>>>>>>
>>>>>>> Here, the prev Link will have the "a" parameter used to build the next
>>>>>>> Link inherited, unless the parameters are reset when LinkBuilder#uri
>>>>>>> method is called.
>>>>>>>
>>>>>>> Do you agree ?
>>>>>>>
>>>>>>
>>>>>> No, i don't.
>>>>>>
>>>>> Is that it, you simply don't agree without even justifying why ?
>>>>>
>>>>> Let me give another try:
>>>>>
>>>>>>> linkBuilder.uri("/next").rel("next").param("a", "a1");
>>>>>>> Link next = linkBuilder.build();
>>>>>>>
>>>>>>> linkBuilder.uri("/prev");
>>>>>>> Link prev = linkBuilder.build();
>>>>>
>>>>> Would it really be what user meant, having "/prev" link having a rel=next ?
>>>>>
>>>>
>>>> You shouldn't be re-using LInkBuilder in this manner, your above example is better exemplified by:
>>>>
>>>> Link next = LinkBuilder.fromUri("/next").param("a", "a1").build();
>>>> Link prev = LinkBuilder.fromUri("/prev").param("b", "b1").build();
>>>
>>> FWIW, I agree with Bill.
>>>
>> Fine, lets just have a statement at the API level as to what the users should expect when they do reuse LinkBuilder; same as we have on UriBuilder and ResponseBuilder - the former has its way to reset certain things, the latter - resets all completely, LinkBuilder docs should advise something too IMHO.
>
> Sergey, I have just released a 2.0-rc3 yesterday as we need to integrate release candidate of JAX-RS RI into Java EE7 RI today and and unless we have more changes I do not feel like releasing another API version just for this single change - unless, of course, you feel really strongly about it and you can justify your request or convince other EG members to support you.
>
No problems, definitely not a big issue. A user reported a relevant one
and I in turn raised it here.

Cheers. Sergey

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