You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Vishal Doshi <vd...@qpass.com> on 2007/02/28 05:24:17 UTC

Question about HttpClient and proxy

Hi,
 
I had a question about how proxy parameters are handled by HttpClient.
It looks like for some reason the HttpClient method that I am using
(passing a PostMethod to executeMethod) is not using the proxy
parameters that I have passed while starting the jvm and instead trying
to connect to the external site directly.
 
Just to make it more clear, I am starting the jvm with the proxy
parameters passed as arguments. I have not explicitly initialized the
HttpClient method with the proxy parameters inside my code, instead I am
relying on the jvm parameters to be picked up by the HttpClient method.
Apparently that doesn't seem to be happening as it is trying to connect
to the external site directly instead of using the proxy configuration.
 
I am currently using 2.0-rc2 version of HttpClient.
 
Any help in this matter would be appreciated.
 
Thanks,
Vishal.

Re: Question about HttpClient and proxy

Posted by Bindul Bhowmik <bi...@gmail.com>.
Vishal,

On 2/27/07, Vishal Doshi <vd...@qpass.com> wrote:
> Hi,
>
> I had a question about how proxy parameters are handled by HttpClient.
> It looks like for some reason the HttpClient method that I am using
> (passing a PostMethod to executeMethod) is not using the proxy
> parameters that I have passed while starting the jvm and instead trying
> to connect to the external site directly.
>
> Just to make it more clear, I am starting the jvm with the proxy
> parameters passed as arguments. I have not explicitly initialized the
> HttpClient method with the proxy parameters inside my code, instead I am
> relying on the jvm parameters to be picked up by the HttpClient method.
> Apparently that doesn't seem to be happening as it is trying to connect
> to the external site directly instead of using the proxy configuration.

HttpClient does not use the proxy parameters set in the JVM. To set a
proxy for HttpClient, use HostConfiguration#setProxy(String, int) or
HostConfiguration#setProxyHost(ProxyHost). [1]

>
> I am currently using 2.0-rc2 version of HttpClient.
>
> Any help in this matter would be appreciated.
>
> Thanks,
> Vishal.
>

HTH
Bindul

[1] http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HostConfiguration.html

-- 
Bindul Bhowmik
MindTree Consulting Ltd.

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