hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vjayaku...@mmm.com
Subject HttpClient Static instance
Date Fri, 20 Oct 2006 16:16:04 GMT
What is issue that might arise by keeping the HttpClient instance static in
a Utility class.

Before I use the static instance of the httpClient I make the check and
initialize it.

Please let me know if there is a better way to implement this?


            //Initialize the HttpClient & enable Concurrent execution of
HTTPmethods
            if(httpClient==null) {
                  MultiThreadedHttpConnectionManager connectionManager =
                        new MultiThreadedHttpConnectionManager();
                  httpClient = new HttpClient(connectionManager);

                  /*Set the proxy*/
                  if (proxy != null) {
                        httpClient.getHostConfiguration().setProxy(proxy,
proxyPort);
                  }
            }

Thanks & Regards,
Vasanth.


---------------------------------------------------------------------
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