On 8/29/11 9:53 AM, Sergey Beryozkin wrote:
> Hi,
>
> On 29/08/11 13:24, Bill Burke wrote:
>>
>>
>> On 8/29/11 5:37 AM, Sergey Beryozkin wrote:
>>> Invocation.prepare(t).get() is a flow on its own and its initialized
>>> when it's really needed to be able to do invoke() or submit() in a
>>> generic fashion...In all other cases - just target.get()/post()/etc;
>>>
>>
>> It seems like it could be strapped on quite easily later on. Maybe wait
>> for user feedback and add it to a 2.1 release of the spec?
>>
>
> It's my turn to ask for some code examples.
> To me, the reason Invocation exists in the 1st place is to provide an
> option for invoke() and submit() at the end of the chain, and thus let
> generic handlers deal with it.
>
> The earlier revision from Marek allowed for an explicit transition from
> Target to Invocation via Target.prepare(). The current revision provides
> nearly the same link, via Target.request(). It just looks worse but
> essentially the same:
>
I personally don't like Target being an "uber" interface. In previous
versions when you looked at Target you didn't know what it was. Is it a
resource? does it represent a URL? A Request? Headers? What?
A request() method separates concerns. Target is a resource, Invocation
is a request.
> client.target("http://examples.jaxrs.com/").request().buildPut(text("Hi")).invoke();
>
>
> ouch...
>
Yeah, but, generic invocations are a corner case. This looks fine:
client.target("http://").request().put(text("Hi"));
I personally don't care much if there is extra steps to support the
corner case of generic invocations. For corner cases in general, I
think its ok to add extra steps.
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com