You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@abdera.apache.org by jm...@apache.org on 2006/11/04 00:21:58 UTC
svn commit: r471048 - in
/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client:
CommonsResponse.java util/AutoReleasingInputStream.java
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;
}