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

[jsr339-experts] Re: Removing command pattern simplifies things

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Mon, 29 Aug 2011 10:50:37 -0400

On Aug 29, 2011, at 10:35 AM, Bill Burke wrote:

>>
>> 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.

 +1

 The Target interface looks weird without this explicit transition.

>
>> 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.

 Exactly.

-- Santiago