Hi,

What I'm trying to say is: is there any way to remove or change something that 
you have already configured with a  builder? It's not only proxy, it's whatever 
you can config. 

For example, I have a HttpClient with a KeepAlivestreategy, proxy, retryhandler 
and a tcp_nodely to true.

With this existing HttpClient, now I want to change (on the fly) this values, 
removing the proxy, keepAlive and retryHandler and changing the tcp_nodelay to 
false.

For example, with 4.2 I could remove a proxy by using:
this.objHttpParams.removeParameter(ConnRoutePNames.DEFAULT_PROXY);

Or I could change tcp_nodelay by using:
HttpConnectionParams.setTcpNoDelay(this.objHttpParams, Boolean.TRUE);


With 4.3, it seems that the only way is to recreate the Httpclient with a 
builder/s with all the new values.


Thanks,

Joan.

-----Mensaje original-----
De: Oleg Kalnichevski [mailto:ol...@apache.org] 
Enviado el: miércoles, 12 de marzo de 2014 17:27
Para: HttpClient User Discussion
Asunto: Re: Migrating from 4.1 to 4.3


On Wed, 2014-03-12 at 15:46 +0100, Joan Balagueró wrote:
> Hello Oleg,
> 
> Thanks. But taking this example:
> 
> RequestConfig.Builder builder = RequestConfig.custom(); if (proxyPort != 0) {
>     builder.setProxy(new HttpHost(proxyHost, proxyPort)) } 
> RequestConfig config = builder.build();
> 
> The question is this can be modified once the CloseableHttpClient is already 
> created. This means that I had a proxy but not now, thus I want to remove 
> this proxy from the HttpClient.
> 
> Must I create another RequestConfig.Builder, reconfigure it with all options  
> (without the setProxy, because now I don't have proxy) and set it again to 
> the HttpClient?
> 
> Thanks,
> Joan.
> 

Use a custom route planner if you want more control over request routing.

http://hc.apache.org/httpcomponents-client-4.3.x/tutorial/html/connmgmt.html#d5e342

Oleg 




---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org

Reply via email to