You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Querent <qu...@yahoo.com> on 2003/08/11 19:24:43 UTC

connect via proxy

Dear all,
 
My program is using Get and Post method in HttpClient. The program works if the internet connection is using dial up. But not if using proxy.
Do I have to set up proxy manually in the program ? (my proxy doesn't need authentication)
Can it just detect the connection from the browsers ?
 
Thanks in advance.
 
Quent


---------------------------------
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

Re: connect via proxy

Posted by Michael Becke <be...@u.washington.edu>.
Hi Quent,

Yes, proxy configuration must be manually set.  This can be done using  
something like:

	HttpClient client = new HttpClient();
	client.getHostConfiguration().setProxy("hostname", 123);
	GetMethod get = new GetMethod("http://somehost.com");
	client.executeMethod(get);

Please take a look at  
<http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/ 
commons/httpclient/HostConfiguration.html> for some more about  
HostConfiguration.

Mike

On Monday, August 11, 2003, at 01:24 PM, Querent wrote:

> Dear all,
>
> My program is using Get and Post method in HttpClient. The program  
> works if the internet connection is using dial up. But not if using  
> proxy.
> Do I have to set up proxy manually in the program ? (my proxy doesn't  
> need authentication)
> Can it just detect the connection from the browsers ?
>
> Thanks in advance.
>
> Quent
>
>
> ---------------------------------
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!