hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From candrews <candr...@integralblue.com>
Subject HttpClient-Cache release that works against HttpClient 4.0?
Date Thu, 03 Nov 2011 18:32:30 GMT

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
-- 
View this message in context: http://old.nabble.com/HttpClient-Cache-release-that-works-against-HttpClient-4.0--tp32775131p32775131.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


Mime
View raw message