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

[jsr339-experts] Re: [Client API] Refactoring Link and Invocation

From: Bill Burke <bburke_at_redhat.com>
Date: Thu, 07 Jul 2011 11:23:57 -0400

On 7/7/11 11:15 AM, Sergey Beryozkin wrote:
>>>
>>> Link link =
>>> client.link("http://jaxrs.examples.org/jaxrsApplication/customers/{id}");
>>>
>>>
>>> link.pathParam("id", 123).get();
>>> link.pathParam("id", 124).get();
>>
>> This is not the same example, you forgot the query param which is used
>> in the first and _not_ the second invocation. This is why the
>> separation between Link and Invocation make sense. See other examples
>> in Bill's message.
>
> Are you saying that in the current API you have to create a new
> Invocation instance per every query ? Does it really make sense ?
>

Yes, just as in your example, you'd have to create a link per query.



> >> link.pathParam("id", 123).query("bar", "foo").get();
> link.query("bar", null);
> >> link.pathParam("id", 124).get();
>

I guess this works if link.pathParam()/queryParam()/header/etc. returns
a *different* Link instance.

But, IMO, you're muddling static vs. dynamic stuff into one object.
Link is both a request and a resource. I still think the current model
is better. It separates concerns, fits perfectly in the interceptor
model, and isn't any less typing.

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