httpclient/pom.xml | 5 +++++ .../org/apache/http/client/entity/GzipCompressingEntity.java | 5 +++-- .../org/apache/http/client/entity/GzipDecompressingEntity.java | 5 +++-- pom.xml | 6 ++++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/httpclient/pom.xml b/httpclient/pom.xml index aa4cc7f..57ffaff 100644 --- a/httpclient/pom.xml +++ b/httpclient/pom.xml @@ -55,6 +55,11 @@ compile + commons-compress + commons-compress + compile + + junit junit test diff --git a/httpclient/src/main/java/org/apache/http/client/entity/GzipCompressingEntity.java b/httpclient/src/main/java/org/apache/http/client/entity/GzipCompressingEntity.java index 0b807d5..02b79a5 100644 --- a/httpclient/src/main/java/org/apache/http/client/entity/GzipCompressingEntity.java +++ b/httpclient/src/main/java/org/apache/http/client/entity/GzipCompressingEntity.java @@ -56,7 +56,6 @@ package org.apache.http.client.entity; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.util.zip.GZIPOutputStream; import org.apache.http.Header; import org.apache.http.HttpEntity; @@ -65,6 +64,8 @@ import org.apache.http.message.BasicHeader; import org.apache.http.protocol.HTTP; import org.apache.http.util.Args; +import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream; + /** * Wrapping entity that compresses content when {@link #writeTo writing}. * @@ -103,7 +104,7 @@ public class GzipCompressingEntity extends HttpEntityWrapper { @Override public void writeTo(final OutputStream outstream) throws IOException { Args.notNull(outstream, "Output stream"); - final GZIPOutputStream gzip = new GZIPOutputStream(outstream); + final GzipCompressorOutputStream gzip = new GzipCompressorOutputStream(outstream); try { wrappedEntity.writeTo(gzip); } finally { diff --git a/httpclient/src/main/java/org/apache/http/client/entity/GzipDecompressingEntity.java b/httpclient/src/main/java/org/apache/http/client/entity/GzipDecompressingEntity.java index a0198ef..3dab2a1 100644 --- a/httpclient/src/main/java/org/apache/http/client/entity/GzipDecompressingEntity.java +++ b/httpclient/src/main/java/org/apache/http/client/entity/GzipDecompressingEntity.java @@ -28,11 +28,12 @@ package org.apache.http.client.entity; import java.io.IOException; import java.io.InputStream; -import java.util.zip.GZIPInputStream; import org.apache.http.Header; import org.apache.http.HttpEntity; +import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream; + /** * {@link org.apache.http.entity.HttpEntityWrapper} for handling gzip * Content Coded responses. @@ -54,7 +55,7 @@ public class GzipDecompressingEntity extends DecompressingEntity { @Override InputStream decorate(final InputStream wrapped) throws IOException { - return new GZIPInputStream(wrapped); + return new GzipCompressorInputStream(wrapped, true); } /** diff --git a/pom.xml b/pom.xml index 16b2761..2c8fe68 100644 --- a/pom.xml +++ b/pom.xml @@ -67,6 +67,7 @@ 4.3 1.1.3 1.6 + 1.5 2.2.0 2.6 1.5.11 @@ -108,6 +109,11 @@ ${commons-codec.version} + commons-compress + commons-compress + ${commons-compress.version} + + net.sf.ehcache ehcache-core ${ehcache.version}