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

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

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Tue, 05 Jul 2011 14:02:05 +0100

>>> 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.
>> link.get().invoke() is a big deal IMHO :-)
>>
>> Of course I was not assuming only plain get() can be done. Current API
>> is Invocation-centric. And Invocation is primarily there to accommodate
>> batch-processing and such. I'd like to see Invocation not visible at all
>> except for those users who know why they need Invocation.
>>
>
> And I'm saying that most users will need to interact with an Invocation:
> to set path parameters, query parameters, headers, entity bodies, etc.
> Having multiple ways to do the same exact thing increases complexity and
> confusion. I just don't see yet how stuffing additional methods into
> Client/Link will make things much simpler.
>
>

Sure.
Imagine Link acts as Invocation. It acts as a builder and finishes with
get/post/etc thus effectively acting as Invocation. But the big
difference is that we don't have yet another factory (Link is a factory)
and the api flow is becoming HTTP-centric.

Invocation does not add anything extra but invoke(). But it forces
get().....invoke() pattern which has very little to do with HTTP
programming IMHO.

I understand why Invocation is there. But it does not mean Invocation
needs to become the central piece of this API.

ClientFactory->Client->Link->Invocation.invoke()

is a way too long a chain.

ClientFactory->Client->Link

is nice IMHO.

and Link.invocable(String httpMethod)

can produce Invocation which has only invoke().

In other words Link can become a central piece of this API, less
indirection as a result, and only when people need to create a batch
job, they will do batchProcess(link.invocable("GET")).

Sergey