abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r471048 - in /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client: CommonsResponse.java util/AutoReleasingInputStream.java
Date Fri, 03 Nov 2006 23:21:58 GMT
Author: jmsnell
Date: Fri Nov  3 15:21:56 2006
New Revision: 471048

URL: http://svn.apache.org/viewvc?view=rev&rev=471048
Log:
Let's give this a shot.  In previous testing I'd noticed problems with the commons client
losing headers
after releasing; however, I haven't been able to duplicate those results and things seem to
actually be 
working rather well.

The AutoReleasingInputStream will release the HttpMethod as soon as the InputStream has been
read fully

Modified:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsResponse.java
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsResponse.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsResponse.java?view=diff&rev=471048&r1=471047&r2=471048
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsResponse.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsResponse.java
Fri Nov  3 15:21:56 2006
@@ -26,6 +26,7 @@
 import java.util.Map;
 
 import org.apache.abdera.Abdera;
+import org.apache.abdera.protocol.client.util.AutoReleasingInputStream;
 import org.apache.abdera.protocol.util.ContentEncodingUtil;
 import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HttpMethod;
@@ -123,7 +124,7 @@
       if (ce != null)
         in = ContentEncodingUtil.getDecodingInputStream(in, ce);
     }
-    return super.getInputStream();
+    return new AutoReleasingInputStream(method,in);
   }
 
   public Date getDateHeader(String header) {

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java?view=diff&rev=471048&r1=471047&r2=471048
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/AutoReleasingInputStream.java
Fri Nov  3 15:21:56 2006
@@ -36,14 +36,18 @@
   @Override
   public int read() throws IOException {
     int r = super.read();
-    if (r == -1) method.releaseConnection();
+    if (r == -1) {
+      method.releaseConnection();
+    }
     return r;
   }
 
   @Override
   public int read(byte[] b, int off, int len) throws IOException {
     int r= super.read(b, off, len);
-    if (r == -1) method.releaseConnection();
+    if (r == -1) {
+      method.releaseConnection();
+    }
     return r;
   }
   



Mime
View raw message