From ea21ed26a76177bbf7ee4274de640ab579e13850 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Sun, 31 May 2015 10:46:03 +0000 Subject: [PATCH] HTTPCLIENT-1654: better backward compatibility git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1682713 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/http/client/config/RequestConfig.java | 13 +++---------- .../client/protocol/ResponseContentEncoding.java | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java b/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java index 459a0c7a4..87f772ff6 100644 --- a/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java +++ b/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java @@ -58,14 +58,13 @@ public class RequestConfig implements Cloneable { private final int connectionRequestTimeout; private final int connectTimeout; private final int socketTimeout; - private final boolean decompressionEnabled; private final boolean contentCompressionEnabled; /** * Intended for CDI compatibility */ protected RequestConfig() { - this(false, null, null, false, null, false, false, false, 0, false, null, null, 0, 0, 0, false, false); + this(false, null, null, false, null, false, false, false, 0, false, null, null, 0, 0, 0, true); } RequestConfig( @@ -84,7 +83,6 @@ public class RequestConfig implements Cloneable { final int connectionRequestTimeout, final int connectTimeout, final int socketTimeout, - final boolean decompressionEnabled, final boolean contentCompressionEnabled) { super(); this.expectContinueEnabled = expectContinueEnabled; @@ -102,7 +100,6 @@ public class RequestConfig implements Cloneable { this.connectionRequestTimeout = connectionRequestTimeout; this.connectTimeout = connectTimeout; this.socketTimeout = socketTimeout; - this.decompressionEnabled = decompressionEnabled; this.contentCompressionEnabled = contentCompressionEnabled; } @@ -319,7 +316,7 @@ public class RequestConfig implements Cloneable { */ @Deprecated public boolean isDecompressionEnabled() { - return decompressionEnabled; + return contentCompressionEnabled; } /** @@ -357,7 +354,6 @@ public class RequestConfig implements Cloneable { builder.append(", connectionRequestTimeout=").append(connectionRequestTimeout); builder.append(", connectTimeout=").append(connectTimeout); builder.append(", socketTimeout=").append(socketTimeout); - builder.append(", decompressionEnabled=").append(decompressionEnabled); builder.append(", contentCompressionEnabled=").append(contentCompressionEnabled); builder.append("]"); return builder.toString(); @@ -406,7 +402,6 @@ public class RequestConfig implements Cloneable { private int connectionRequestTimeout; private int connectTimeout; private int socketTimeout; - private boolean decompressionEnabled; private boolean contentCompressionEnabled; Builder() { @@ -419,7 +414,6 @@ public class RequestConfig implements Cloneable { this.connectionRequestTimeout = -1; this.connectTimeout = -1; this.socketTimeout = -1; - this.decompressionEnabled = true; this.contentCompressionEnabled = true; } @@ -509,7 +503,7 @@ public class RequestConfig implements Cloneable { */ @Deprecated public Builder setDecompressionEnabled(final boolean decompressionEnabled) { - this.decompressionEnabled = decompressionEnabled; + this.contentCompressionEnabled = decompressionEnabled; return this; } @@ -535,7 +529,6 @@ public class RequestConfig implements Cloneable { connectionRequestTimeout, connectTimeout, socketTimeout, - decompressionEnabled, contentCompressionEnabled); } diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/ResponseContentEncoding.java b/httpclient/src/main/java/org/apache/http/client/protocol/ResponseContentEncoding.java index 9cb4adbbe..c4d0cfc9f 100644 --- a/httpclient/src/main/java/org/apache/http/client/protocol/ResponseContentEncoding.java +++ b/httpclient/src/main/java/org/apache/http/client/protocol/ResponseContentEncoding.java @@ -129,7 +129,7 @@ public class ResponseContentEncoding implements HttpResponseInterceptor { final RequestConfig requestConfig = clientContext.getRequestConfig(); // entity can be null in case of 304 Not Modified, 204 No Content or similar // check for zero length entity. - if (requestConfig.isDecompressionEnabled() && entity != null && entity.getContentLength() != 0) { + if (requestConfig.isContentCompressionEnabled() && entity != null && entity.getContentLength() != 0) { final Header ceheader = entity.getContentEncoding(); if (ceheader != null) { final HeaderElement[] codecs = ceheader.getElements();