Hi all,

I am using httpclient 3.1 in a servlet to check if a URL is alive or not. 
When should I best initialize HttpClient? I was thinking to create a 
HttpClient instance in the servlet constructor and to execute a HeadMethod 
in the doGet method of the servlet. Is this the right way to do it or 
should I better create a new instance of HttpClient in doGet for each 
request?

Also, I want the HeadMethod to stop after a certain amount of time. How 
can I set a timeout? I am using 
HttpClient.getHttpConnectionManager().getParams().setConnectionTimeout(timeOut) 
and 
HttpClient.getHttpConnectionManager().getParams().setSoTimeout(timeOut), 
but there is also HttpClient.getParams().setSoTimeout(timeOut), 
HttpClient.getParams().setParameter("http.socket.timeout", new 
Integer(timeOut)), 
HttpClient.getParams().setConnectionManagerTimeout(timeOut), 
HeadMethod.getParams().setParameter("http.socket.timeout", new 
Integer(timeOut)) and 
HostConfiguration.getParams().setParameter("http.socket.timeout", 
timeOut). What is the difference between them?

Many thanks for any help!

Reply via email to