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 Steven Adams <st...@gmail.com> on 2008/10/07 08:33:19 UTC
Force httpclient to use an alt IP
Hi All,
I have several IP's on the server I'm using HttpClient 4.
I would like to force httpclient to use one of the other IP's, can
someone please tell me if this is possible and how?
Thanks
Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: Force httpclient to use an alt IP
Posted by Steven Adams <st...@gmail.com>.
Ahh..
Thanks Oleg.
Oleg Kalnichevski wrote:
> On Tue, 2008-10-07 at 17:33 +1100, Steven Adams wrote:
>
>> Hi All,
>>
>> I have several IP's on the server I'm using HttpClient 4.
>>
>> I would like to force httpclient to use one of the other IP's, can
>> someone please tell me if this is possible and how?
>>
>> Thanks
>> Steve
>>
>>
>
> Set 'http.route.local-address' parameter to the desired local address
> either on the client or request level:
>
> ---
> DefaultHttpClient httpclient = new DefaultHttpClient(params);
>
> httpclient.getParams().setParameter(
> ConnRouteParams.LOCAL_ADDRESS, Inet4Address.getLocalHost());
>
> HttpGet httpget = new HttpGet("http://localhost:8080");
> httpget.getParams().setParameter(
> ConnRouteParams.LOCAL_ADDRESS, Inet4Address.getLocalHost());
>
> HttpResponse response = httpclient.execute(httpget);
> ---
>
> Hope this helps
>
> Oleg
>
>
>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: Force httpclient to use an alt IP
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2008-10-07 at 17:33 +1100, Steven Adams wrote:
> Hi All,
>
> I have several IP's on the server I'm using HttpClient 4.
>
> I would like to force httpclient to use one of the other IP's, can
> someone please tell me if this is possible and how?
>
> Thanks
> Steve
>
Set 'http.route.local-address' parameter to the desired local address
either on the client or request level:
---
DefaultHttpClient httpclient = new DefaultHttpClient(params);
httpclient.getParams().setParameter(
ConnRouteParams.LOCAL_ADDRESS, Inet4Address.getLocalHost());
HttpGet httpget = new HttpGet("http://localhost:8080");
httpget.getParams().setParameter(
ConnRouteParams.LOCAL_ADDRESS, Inet4Address.getLocalHost());
HttpResponse response = httpclient.execute(httpget);
---
Hope this helps
Oleg
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org