On Fri, 2014-11-14 at 11:19 +0530, Vicky wrote:
> Hi Folks,
> 
> We have are in a process of migrating our HTTP client library from 4.0.1 to
> 4.3.5 version. There are 2 migration areas we i have not been able to
> figure out so far,
> 
> 1. Dynamic adding of new Schema Registry to ClientConnectionManager. That
> is, HttpClient object was already created with just HTTPS schema. But now
> for a certain usecase we need to add http schema as well. We could do this
> in the earlier version via the below code,
> 

What is exactly the benefit of doing so? 

The only way to do the same with newer APIs is to upgrade to 4.4 and to
create a custom HttpClientConnectionOperator.


> ClientConnectionManager manager = httpClient.getConnectionManager();
> manager.getSchemeRegistry().register(new Scheme(HttpMethods.PROTOCOL_HTTP,
> PlainSocketFactory.getSocketFactory(), 80));
> 
> But haven't been able to figure out how to do this with the newer version.
> 
> 2. Dynamically adding and removing interceptors. After HttpClient object is
> created for certain requests we needed to dynamically remove certain
> interceptors. Example for a one case we needed to ignore/disable cookie
> usage. With earlier version we could do it like below,
> 
> ((DefaultHttpClient)httpClient).removeRequestInterceptorByClass(RequestAddCookies.class);
> ((DefaultHttpClient)httpClient).removeResponseInterceptorByClass(ResponseProcessCookies.class);
> 
> Couldn't find a way to do it in 4.3.5.
> 

The recommended way would be to add the interceptors at construction
time but use a custom flag in HttpContext to enable / disable /
customize their behavior at runtime.

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to