hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Dealing with a deprecated ContentEncodingHttpClient
Date Mon, 01 Oct 2012 14:49:46 GMT
 Hi All:

I have 4.2.1 client code like this:

   private DefaultHttpClient httpClient;
   ...
   this.httpClient = new *ContentEncodingHttpClient*(new
PoolingClientConnectionManager(this.schemeRegistry), params);

According to the Javadoc I should use a DecompressingHttpClient instead, so
I code:

   this.httpClient = new DecompressingHttpClient(new
DecompressingHttpClient (new
PoolingClientConnectionManager(this.schemeRegistry), params));

Which means I have to retype DefaultHttpClient as a DecompressingHttpClient.

I do not use the HttpClient interface because I need to call
org.apache.http.impl.client.AbstractHttpClient.getCredentialsProvider()

But there is no way to get from a DecompressingHttpClient (which implements
HttpClient) to its DefaultHttpClient so I can call getCredentialsProvider().

In order to do what I need would need to save both DecompressingHttpClient
and its DecompressingHttpClient in ivars which smells wrong to me.

Option 1:

Add "public HttpClient getBackend()" to DecompressingHttpClient, which I
can call and cast to a DefaultHttpClient.

Option 2:

?

Gary


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message