hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1767340 - in /httpcomponents/httpcore/trunk: httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ httpcore5/src/main/java/org/apache/hc/core5/http/ httpcore5/src/main/java/org/apache/hc/core5/http/impl/ httpcore5/src/main/j...
Date Mon, 31 Oct 2016 17:33:57 GMT
Author: olegk
Date: Mon Oct 31 17:33:57 2016
New Revision: 1767340

URL: http://svn.apache.org/viewvc?rev=1767340&view=rev
Log:
HttpEntity and ClassicHttpResponse made extend Closeable

Modified:
    httpcomponents/httpcore/trunk/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/TestClassicHttp.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ClassicHttpResponse.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/HttpEntity.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/IncomingHttpEntity.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/BasicHttpEntity.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteArrayEntity.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteBufferEntity.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/FileEntity.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWithTrailers.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWrapper.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/InputStreamEntity.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/SerializableEntity.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/StringEntity.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicClassicHttpResponse.java

Modified: httpcomponents/httpcore/trunk/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/TestClassicHttp.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/TestClassicHttp.java?rev=1767340&r1=1767339&r2=1767340&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/TestClassicHttp.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/TestClassicHttp.java
Mon Oct 31 17:33:57 2016
@@ -641,6 +641,10 @@ public class TestClassicHttp {
             outstream.flush();
         }
 
+        @Override
+        public void close() throws IOException {
+        }
+
     }
 
     @Test

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ClassicHttpResponse.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ClassicHttpResponse.java?rev=1767340&r1=1767339&r2=1767340&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ClassicHttpResponse.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/ClassicHttpResponse.java
Mon Oct 31 17:33:57 2016
@@ -27,12 +27,14 @@
 
 package org.apache.hc.core5.http;
 
+import java.io.Closeable;
+
 /**
  * 'Classic' {@link HttpResponse} message that can enclose {@link HttpEntity}.
  *
  * @since 5.0
  */
-public interface ClassicHttpResponse extends HttpResponse {
+public interface ClassicHttpResponse extends HttpResponse, Closeable {
 
     /**
      * Obtains the message entity, if available.

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/HttpEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/HttpEntity.java?rev=1767340&r1=1767339&r2=1767340&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/HttpEntity.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/HttpEntity.java
Mon Oct 31 17:33:57 2016
@@ -27,6 +27,7 @@
 
 package org.apache.hc.core5.http;
 
+import java.io.Closeable;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -59,7 +60,7 @@ import java.io.OutputStream;
  *
  * @since 4.0
  */
-public interface HttpEntity extends EntityDetails {
+public interface HttpEntity extends EntityDetails, Closeable {
 
     /**
      * Tells if the entity is capable of producing its data more than once.

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/IncomingHttpEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/IncomingHttpEntity.java?rev=1767340&r1=1767339&r2=1767340&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/IncomingHttpEntity.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/IncomingHttpEntity.java
Mon Oct 31 17:33:57 2016
@@ -34,8 +34,8 @@ import java.util.Set;
 
 import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.TrailerSupplier;
-import org.apache.hc.core5.http.io.entity.AbstractImmutableHttpEntity;
 import org.apache.hc.core5.http.impl.io.EmptyInputStream;
+import org.apache.hc.core5.http.io.entity.AbstractImmutableHttpEntity;
 
 /**
  * Represents entity received from an open connection.
@@ -103,4 +103,11 @@ public class IncomingHttpEntity extends
         return Collections.emptySet();
     }
 
+    @Override
+    public void close() throws IOException {
+        if (content != null) {
+            content.close();
+        }
+    }
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/BasicHttpEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/BasicHttpEntity.java?rev=1767340&r1=1767339&r2=1767340&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/BasicHttpEntity.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/BasicHttpEntity.java
Mon Oct 31 17:33:57 2016
@@ -27,6 +27,7 @@
 
 package org.apache.hc.core5.http.io.entity;
 
+import java.io.IOException;
 import java.io.InputStream;
 
 import org.apache.hc.core5.http.impl.io.EmptyInputStream;
@@ -108,4 +109,11 @@ public class BasicHttpEntity extends Abs
         return this.content != null && this.content != EmptyInputStream.INSTANCE;
     }
 
+    @Override
+    public void close() throws IOException {
+        if (content != null) {
+            content.close();
+        }
+    }
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteArrayEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteArrayEntity.java?rev=1767340&r1=1767339&r2=1767340&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteArrayEntity.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteArrayEntity.java
Mon Oct 31 17:33:57 2016
@@ -116,4 +116,8 @@ public class ByteArrayEntity extends Abs
         return false;
     }
 
-} // class ByteArrayEntity
+    @Override
+    public void close() throws IOException {
+    }
+
+}

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteBufferEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteBufferEntity.java?rev=1767340&r1=1767339&r2=1767340&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteBufferEntity.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/ByteBufferEntity.java
Mon Oct 31 17:33:57 2016
@@ -39,7 +39,7 @@ import org.apache.hc.core5.util.Args;
 /**
  * An entity that delivers the contents of a {@link ByteBuffer}.
  */
-public class ByteBufferEntity extends AbstractHttpEntity implements Cloneable {
+public class ByteBufferEntity extends AbstractHttpEntity {
 
     private final ByteBuffer buffer;
 
@@ -111,7 +111,7 @@ public class ByteBufferEntity extends Ab
     }
 
     @Override
-    public Object clone() throws CloneNotSupportedException {
-        return super.clone();
+    public void close() throws IOException {
     }
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/FileEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/FileEntity.java?rev=1767340&r1=1767339&r2=1767340&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/FileEntity.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/FileEntity.java
Mon Oct 31 17:33:57 2016
@@ -87,4 +87,8 @@ public class FileEntity extends Abstract
         return false;
     }
 
-} // class FileEntity
+    @Override
+    public void close() throws IOException {
+    }
+
+}

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWithTrailers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWithTrailers.java?rev=1767340&r1=1767339&r2=1767340&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWithTrailers.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWithTrailers.java
Mon Oct 31 17:33:57 2016
@@ -118,4 +118,9 @@ public class HttpEntityWithTrailers impl
         return names;
     }
 
+    @Override
+    public void close() throws IOException {
+        wrappedEntity.close();
+    }
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWrapper.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWrapper.java?rev=1767340&r1=1767339&r2=1767340&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWrapper.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWrapper.java
Mon Oct 31 17:33:57 2016
@@ -110,4 +110,9 @@ public class HttpEntityWrapper implement
         return wrappedEntity.getTrailerNames();
     }
 
+    @Override
+    public void close() throws IOException {
+        wrappedEntity.close();
+    }
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/InputStreamEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/InputStreamEntity.java?rev=1767340&r1=1767339&r2=1767340&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/InputStreamEntity.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/InputStreamEntity.java
Mon Oct 31 17:33:57 2016
@@ -155,4 +155,9 @@ public class InputStreamEntity extends A
         return true;
     }
 
+    @Override
+    public void close() throws IOException {
+        content.close();
+    }
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/SerializableEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/SerializableEntity.java?rev=1767340&r1=1767339&r2=1767340&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/SerializableEntity.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/SerializableEntity.java
Mon Oct 31 17:33:57 2016
@@ -125,4 +125,8 @@ public class SerializableEntity extends
         }
     }
 
+    @Override
+    public void close() throws IOException {
+    }
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/StringEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/StringEntity.java?rev=1767340&r1=1767339&r2=1767340&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/StringEntity.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/StringEntity.java
Mon Oct 31 17:33:57 2016
@@ -130,4 +130,8 @@ public class StringEntity extends Abstra
         return false;
     }
 
-} // class StringEntity
+    @Override
+    public void close() throws IOException {
+    }
+
+}

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicClassicHttpResponse.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicClassicHttpResponse.java?rev=1767340&r1=1767339&r2=1767340&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicClassicHttpResponse.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicClassicHttpResponse.java
Mon Oct 31 17:33:57 2016
@@ -27,6 +27,7 @@
 
 package org.apache.hc.core5.http.message;
 
+import java.io.IOException;
 import java.util.Locale;
 
 import org.apache.hc.core5.http.ClassicHttpResponse;
@@ -85,4 +86,11 @@ public class BasicClassicHttpResponse ex
         this.entity = entity;
     }
 
+    @Override
+    public void close() throws IOException {
+        if (entity != null) {
+            entity.close();
+        }
+    }
+
 }



Mime
View raw message