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 11:58:02 +0100

>
>> Another example to illustrate that the resources are really different
>> is here - consider which of the following reads
>> better:
>>
>> 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");
>> Target library = library.path("books");
>> Target 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. A is more naturally readable - but you can't get from the books
> section back to the library entry. Which is possible with B...

You should've named Target in B) as libraryResource :-).
library, books, dantesDivineComedy, are all libraryResources :-), with
the latter two being library subresources...

Not that that matters but I thought I'd add yet another comment :-)
Sergey

>
>>>
>>> Will double check if Invocation flow returns a new instance each
>>> time, if not then having the target and invocation
>>> flows combined also seems non-intuitive - however seeing no problem
>>> with it...
>>> Will continue my analysis
>>
>> Invocation.Builder is a builder. It's mutable. Similarly HttpRequest
>> is mutable, but it's because it's primarily
>> targeted at different audience - filters and handlers or some advanced
>> power users of the client API.
>>
> OK
>
> thanks, Sergey
>
>> Marek


-- 
Sergey Beryozkin
http://sberyozkin.blogspot.com
Talend - http://www.talend.com