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

[jsr339-experts] Re: [jax-rs-spec users] Re: Removing command pattern simplifies things

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Tue, 30 Aug 2011 16:45:24 +0100

The problem though the idea of the iteration is not easily implementable

Consider we have a base and a set of relative ones, which have to be
tried one by one,

without the explicit separation between URI and request we can have

Target t = client.target("http://bar").accept("text/xml");
for (String relLink: links) {
    t.path(relLink);
    saveResponse(t.get());
    // back to the prev segment, base URI in this case - more on it later
    t.back();
}

it appears to be more difficult to achieve with the current rev,
because path() is settable on Target but not on Invocation.

I guess I'm still after having Invocation dealing only with invoke().
Just lets rename Target to something more meaningful that can
'accomodate' setting headers and paths and entities

Feel free to ignore :-)
Sergey

On 30/08/11 11:03, Sergey Beryozkin wrote:
>>
>> A target and a request are clearly separate concepts. I can create a
>> target and then submit multiple requests from it. IMO, the transition
>> looks good even at the user level. Consider,
>>
>> Target target = …
>> target.header(…)
>
> right...I start warming up a bit to the fact that first a target URI is
> being created, and only then, after a transition, headers and or entity
> is added...
>
> Sergey
>
>>
>> What does it mean to add a header to target? Headers really belong to
>> requests, not targets. To semantically explain the statement above,
>> you need to think about the transition between a target and a request,
>> and I in general like things to be explicit.
>>
>> -- Santiago
>>
>
>


-- 
Sergey Beryozkin
http://sberyozkin.blogspot.com
Talend - http://www.talend.com