users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: Client initialization on server-side

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Thu, 19 Apr 2012 11:46:02 +0100

On 19/04/12 10:57, Jan Algermissen wrote:
>
> On Apr 19, 2012, at 11:17 AM, Sergey Beryozkin wrote:
>
>> On 18/04/12 17:27, Bill Burke wrote:
>>>
>>>
>>> On 4/18/12 3:05 AM, Jan Algermissen wrote:
>>>> Hi Bill,
>>>>
>>>> On Apr 17, 2012, at 6:07 PM, Bill Burke wrote:
>>>>
>>>>>
>>>>> Container management of Client should be optional. There's a lot of
>>>>> issues involved, especially when you start dealing with HTTPS,
>>>>> trust-stores, authentication, etc. that may be endpoint specific.
>>>>
>>>> Can you explain how that is any different from DB connection
>>>> authentication?
>>>>
>>>
>>> I guess what I mean is, you shouldn't have to inject a Client to use
>>> one.
>>
>> +1
>>
>>> Although injecting a ClientFactory could be made mandatory.
>>
>> I think that the per-request initialization should be allowed.
>> Cheers, Sergey
>
> Can you explain the rationale behind your replies? (Not to say I disagree - merely try to understand)
>
>
> Maybe we are missing a differentiation here between HTTP connector and User Agent component?
>
> The User Agent, by its very nature being a direct implementation of client side expectations, is indeed no something that makes sense to be provided by the container. The HTTP connector however is, because it is (much like database connections) application agnostic.
>
Jan, what I mean is that there has to be no restrictions in the way one
can instantiate a client withing a server application code.
If JAX-RS 2.0 supports say the injection of say ClientFactory
(representing, hope I'm right here :-), the connector) then it would be
OK with me, but I do not think it must be a requirement. That is, if I
know it's very cheap to consume a given resource then I should be able
to do within the scope of the current request:

//all within the scope of the current request
Client c = ClientFactory.newClient();
// use it

Cheers, Sergey


> Makes sense?
>
> Jan
>
>
>
>
>
>>
>>
>>>
>>>
>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>> Blog: http://sberyozkin.blogspot.com
>