hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1369841 - in /httpcomponents/httpclient/trunk/httpclient: ./ src/main/java/org/apache/http/impl/client/DecompressingHttpClient.java src/test/java/org/apache/http/impl/client/TestContentCodings.java
Date Mon, 06 Aug 2012 13:32:35 GMT
Author: ggregory
Date: Mon Aug  6 13:32:35 2012
New Revision: 1369841

URL: http://svn.apache.org/viewvc?rev=1369841&view=rev
Log:
[HTTPCLIENT-1221] Add DecompressingHttpClient 0-arg constructor using the DefaultHttpClient.

Modified:
    httpcomponents/httpclient/trunk/httpclient/   (props changed)
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DecompressingHttpClient.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestContentCodings.java

Propchange: httpcomponents/httpclient/trunk/httpclient/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Aug  6 13:32:35 2012
@@ -5,3 +5,5 @@ bin
 lib
 .settings
 .pmd
+.externalToolBuilders
+maven-eclipse.xml

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DecompressingHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DecompressingHttpClient.java?rev=1369841&r1=1369840&r2=1369841&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DecompressingHttpClient.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DecompressingHttpClient.java
Mon Aug  6 13:32:35 2012
@@ -73,20 +73,28 @@ import org.apache.http.util.EntityUtils;
  */
 public class DecompressingHttpClient implements HttpClient {
 
-    private HttpClient backend;
-    private HttpRequestInterceptor acceptEncodingInterceptor;
-    private HttpResponseInterceptor contentEncodingInterceptor;
+    private final HttpClient backend;
+    private final HttpRequestInterceptor acceptEncodingInterceptor;
+    private final HttpResponseInterceptor contentEncodingInterceptor;
     
     /**
      * Constructs a decorator to ask for and handle compressed
      * entities on the fly.
+     */
+    public DecompressingHttpClient() {
+        this(new DefaultHttpClient());
+    }
+
+    /**
+     * Constructs a decorator to ask for and handle compressed
+     * entities on the fly.
      * @param backend the {@link HttpClient} to use for actually
      *   issuing requests
      */
     public DecompressingHttpClient(HttpClient backend) {
         this(backend, new RequestAcceptEncoding(), new ResponseContentEncoding());
     }
-    
+        
     DecompressingHttpClient(HttpClient backend, 
             HttpRequestInterceptor requestInterceptor, 
             HttpResponseInterceptor responseInterceptor) {

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestContentCodings.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestContentCodings.java?rev=1369841&r1=1369840&r2=1369841&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestContentCodings.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestContentCodings.java
Mon Aug  6 13:32:35 2012
@@ -91,7 +91,7 @@ public class TestContentCodings extends 
             }
         });
 
-        HttpClient client = new DecompressingHttpClient(new DefaultHttpClient());
+        HttpClient client = new DecompressingHttpClient();
 
         HttpGet request = new HttpGet("/some-resource");
         HttpResponse response = client.execute(getServerHttp(), request);
@@ -114,7 +114,7 @@ public class TestContentCodings extends 
 
         this.localServer.register("*", createDeflateEncodingRequestHandler(entityText, false));
 
-        HttpClient client = new DecompressingHttpClient(new DefaultHttpClient());
+        HttpClient client = new DecompressingHttpClient();
 
         HttpGet request = new HttpGet("/some-resource");
         HttpResponse response = client.execute(getServerHttp(), request);
@@ -137,7 +137,7 @@ public class TestContentCodings extends 
 
         this.localServer.register("*", createDeflateEncodingRequestHandler(entityText, true));
 
-        HttpClient client = new DecompressingHttpClient(new DefaultHttpClient());
+        HttpClient client = new DecompressingHttpClient();
 
         HttpGet request = new HttpGet("/some-resource");
         HttpResponse response = client.execute(getServerHttp(), request);
@@ -158,7 +158,7 @@ public class TestContentCodings extends 
 
         this.localServer.register("*", createGzipEncodingRequestHandler(entityText));
 
-        HttpClient client = new DecompressingHttpClient(new DefaultHttpClient());
+        HttpClient client = new DecompressingHttpClient();
 
         HttpGet request = new HttpGet("/some-resource");
         HttpResponse response = client.execute(getServerHttp(), request);
@@ -236,7 +236,7 @@ public class TestContentCodings extends 
 
         this.localServer.register("*", createGzipEncodingRequestHandler(entityText));
 
-        HttpClient client = new DecompressingHttpClient(new DefaultHttpClient());
+        HttpClient client = new DecompressingHttpClient();
         HttpGet request = new HttpGet("/some-resource");
         HttpResponse response = client.execute(getServerHttp(), request);
         ByteArrayOutputStream out = new ByteArrayOutputStream();
@@ -260,7 +260,7 @@ public class TestContentCodings extends 
 
         this.localServer.register("*", createDeflateEncodingRequestHandler(entityText, true));
 
-        HttpClient client = new DecompressingHttpClient(new DefaultHttpClient());
+        HttpClient client = new DecompressingHttpClient();
 
         HttpGet request = new HttpGet("/some-resource");
         HttpResponse response = client.execute(getServerHttp(), request);
@@ -279,7 +279,7 @@ public class TestContentCodings extends 
 
         this.localServer.register("*", createGzipEncodingRequestHandler(entityText));
 
-        HttpClient client = new DecompressingHttpClient(new DefaultHttpClient());
+        HttpClient client = new DecompressingHttpClient();
 
         HttpGet request = new HttpGet("/some-resource");
         String response = client.execute(getServerHttp(), request, new BasicResponseHandler());
@@ -294,7 +294,7 @@ public class TestContentCodings extends 
 
         this.localServer.register("*", createDeflateEncodingRequestHandler(entityText, false));
 
-        HttpClient client = new DecompressingHttpClient(new DefaultHttpClient());
+        HttpClient client = new DecompressingHttpClient();
         
         HttpGet request = new HttpGet("/some-resource");
         String response = client.execute(getServerHttp(), request, new BasicResponseHandler());



Mime
View raw message