hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: minimum object creation
Date Tue, 24 Jan 2006 15:47:47 GMT
On Tue, 2006-01-24 at 16:24 +0100, klaus.kopruch@Materna.de wrote:
> Hello * !
> 
> I'm developing a java component which sends requests to multiple http
> servers. I have the requirement that the following properties have to be
> adjustable per host/port:
> 
> + basic authentication (usr/pwd)
> + http version 1.0 or 1.1
> + proxy using
> + socket and connection timeout
> + max. connections per host
> 
> I dont want to create more objects than really needed, but I think I have to
> create the following instances:
> 
> + HttpClient per host: basic authentication (usr/pwd)

You could also use an HttpState instance instead

> + HostConfiguration per host: proxy using

You can also set a host-specific socket timeout value here

> + HttpConnectionManager per host: socket and connection timeout, max.
> connections per host

This is the only way to set a host-specific connect timeout value.
However, if you are prepared to live with the same connect timeout value
for all the hosts, I would recommend using a shared connection manager

> + HttpMethod per request
> 

Yep

> Do I have to create at least these instances, or is it possible to have only
> one instance of HttpClient ?

You should reuse HttpClient if you are also going to reuse the
connection manager. Otherwise you should create an instance of
HttpClient per host (along with an instance of the connection
manager)   

> If I could set the socket and connection timeout in the HostConfiguration I
> can manage with only one instance of HttpConnectionManager, but this seems
> not to be possible ?
> 

It is not possible to set the connect timeout on a per host basis

Hope this helps

Oleg

> Any suggestions ? 
> 
> Thanks
> 
> Klaus
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message