hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Puneet Lakhina" <puneet.lakh...@gmail.com>
Subject Re: How to set proxy information in httpClient object from browser
Date Wed, 05 Sep 2007 18:46:17 GMT
On 8/29/07, nitya vyas <nitya.vyas@gmail.com> wrote:
> Hi there,
> I am using a single HTTPClient object (static) for the desktop application
> with different method objects (get,post,multipartpost) for each call..I
> have also implemented StrictSSLSocketFactory implementation (SSL) for that
> httpClient object. Now i m suppose to get the proxy information from the
> default browser and set the proxy for all requests. I believe it must be
> done for the same static httpClient object for my app but dont know how..

Two things
1. How to get the default proxy settings from the system. IDid some googling
on this, found no way to easily get the windows default internet settings
(similar to what firefox can do on windows when you install and run it).

2. How to set a proxy - I have done this for absolute basic httpclient, dont
know if anything different needs to be done for SSL connections. For this
you can use the HostConfiguration parameter of the executeMethod method.
Something like this
HttpClient httpClient = new HttpClient();
GetMethod getMethod = new GetMethod("http://www.apache.org/");
HostConfiguration hostConfig = new HostConfiguration();
//set proxy host and port

//Dont forget

can anyone please guide me how this can be achieved? I think setProxy() can
> be done on HttpConnection object and not HTTPClient. So how do i set the
> proxy for my httpClient ???
> thanks.
> Nitya

Hope it helps.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message