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

[jsr339-experts] Re: Some comments about Target and Invocation

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Fri, 2 Sep 2011 13:55:06 +0100

Sorry for the noise,
>>>>
>>>> A)
>>>> Target library = Client.target("http://library");
>>>> Target books = library.path("books");
>>>> Target dantesDivineComedy = books.queryParam("ISBN-13",
>>>> "978-0451208637");
>>>>
>>>> B)
>>>> Target library = Client.target("http://library");
>>>> library = library.path("books");
>>>> library = books.queryParam("ISBN-13", "978-0451208637");
>>>>
>>>> I hope we can agree that A) makes more sense.
>>>>
>>> A) looks fine, but a bit unusual, when I type a URI in the browser,
>>> I'm still working with the same URI string, which I
>>> guess B) captures pretty well.
>>
>> What are you trying to say? We don't work here with strings, we work
>> with resources and their URIs. This is not a text
>> editor API.
>>
> I'm simply giving you my feedback. You cleverly chose the naming of
> Target in A) to demo the immutability and yes, the fact we have 3
> individual resources there. I said that B) can also be used to reflect
> the actual way a user works with the service.
>
>>> A is more naturally readable - but you can't get from the books
>>> section back to the
>>> library entry. Which is possible with B...
>>
>> Are you really suggesting, that in the example A, after executing line
>> 2 you cannot refer to the library, but in the
>> (corrected) example B you can?? Are we both still talking about Java
>> code? :)
>>
> I clearly said that you can't move back from
> books to library - are you suggesting that is possible ?

not possible with B either - unless it has back() of course, which has
more sense for mutable target uris - this clarification was probably not
needed - but I'm conscious now that at least I try to provide clear
answers :-)

thanks...