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

[jsr339-experts] Re: [ClientAPI] Naming Proposals

From: Bill Burke <bburke_at_redhat.com>
Date: Tue, 05 Jul 2011 08:17:27 -0400

On 7/5/11 7:59 AM, Sergey Beryozkin wrote:
> Hi,
>> Didn't we originally have:
>>
>> Response = invocation.get();
>> Future = invocatoin.getAsync();
>>
>> Maybe have
>>
>> AsyncInvocation a = client.async();
>> Invocation i = client.invocation();
>>
>> Future f = a.get();
>> Future f = a.post();
>>
>> String enttity = i.get(String.class);
>>
>> Remove the invoke() and queue() methods. This way get, post, et. al.
>> is always invoked last to trigger the actual invocation.
>>
>
> Lets keep get()/etc with Link and have get()/etc finishing the chain,
> and have Link optionally creating an initialized Invocation which will
> do its invoke().
>
> IMHO Link is an HTTP-centric thing and it should do get().
>

I disagree. Link should be a request factory, thats it. If you have
anything even slightly complex, an Invocation will need to get created
anyways, i.e. if the Link is a uri with path parameters or if you want
to set a specific query parameter. Also, with a post, or put you'll
want to set the entity body, form parameters, etc. Besides all you're
saving is:

link.request().get();

vs.

link.get()

Not a big deal, IMO.

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