Http client API

Alan Bateman Alan.Bateman at oracle.com
Wed Aug 15 09:32:39 PDT 2012


On 15/08/2012 16:59, Mike Duigou wrote:
> On Aug 15 2012, at 09:06 , Michael McMahon wrote:
>
>>> :
>> Yes, the provider needs work. I agree with the above. Though I don't know about the
>> necessity to provide multiple alternate providers.
> If there is only ever going to be one provider then why include a provider interface. I suspect that HttpClient will have about as many implementations as there are JCE providers, ie. less than 10 but it is possible that someone may have more than one simultaneously and want to select a particular provider.
>
I haven't studied this API in much detail yet but I assume that 
HttpClientProvider is just a factory for HttpClients and when you invoke 
HttpClient.createClient it just delegates to the system-wise provider to 
create the HttpClient. Once the javadoc is fleshed out more then I 
assume that it will document how the system-wise default provider is 
chosen. I assume it just uses ServiceLoader with a system property or 
some means to override. This approach would be consistent with how 
several other provider interfaces work in the JDK. The approach also 
doesn't preclude using multiple providers at the same time although if 
you want a specific HttpClient then I assume it means getting a 
reference to the provider and invoking its factory method directly. It's 
the same thing with the NIO provider interfaces although the number of 
provider implementations there will be a less than what I expect here.

-Alan.



More information about the net-dev mailing list