On Thu, 2011-11-03 at 11:32 -0700, candrews wrote:
> HttpClient-Cache doesn't work against HttpClient 4.0 because it uses
> org.apache.http.util.EntityUtils.consume(org.apache.http.HttpEntity) which
> wasn't introduced until HttpClient 4.1.
> 
> Since Android uses HttpClient 4.0 (yes, it sucks that they won't upgrade,
> and I don't understand their reasons for not upgrading, but anyways), this
> means you can't use HttpClient-Cache on Android - and IMHO, it would be
> really useful.
> 
> Could HttpClient-Cache simply not use
> org.apache.http.util.EntityUtils.consume and therefore set the minimum
> HttpClient version to 4.0? The change seems quite simple - in
> ResponseProtocolCompliance, use this method body instead of the existing
> one:
> 
>     private void consumeBody(HttpResponse response) throws IOException {
>         HttpEntity body = response.getEntity();
>         if (body != null){
>          if (body.isStreaming()) {
>              InputStream instream = body.getContent();
>              if (instream != null) {
>                  instream.close();
>              }
>          }
>     }
> 
> Thank you,
> ~Craig

Crag,

The problem is that what Google ships with Android platform is an
extremely outdated, pre-BETA version of HttpClient. There have been
literally hundreds of changes and bug fixes since that version that
Google never bothered to backport. I personally see no point in
maintaining compatibility with Adnroid's version of HttpClient.  

You will be much better off using the latest version of HttpClient
repackaged to a different name space such as
'screw.you.google.org.apache.http'. If you are a Maven user you could
use Maven Shade plugin to create a package of HttpClient with a custom
package namespace.  

Hope this helps

Oleg


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

Reply via email to