abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ckopp...@apache.org
Subject svn commit: r1065250 - in /abdera/java/trunk/client/src: main/java/org/apache/abdera/protocol/client/CommonsResponse.java test/java/org/apache/abdera/test/client/HeadTest.java
Date Sun, 30 Jan 2011 11:27:05 GMT
Author: ckoppelt
Date: Sun Jan 30 11:27:04 2011
New Revision: 1065250

URL: http://svn.apache.org/viewvc?rev=1065250&view=rev
Log:
fix for ABDERA-259

Added:
    abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/HeadTest.java
Modified:
    abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsResponse.java

Modified: abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsResponse.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsResponse.java?rev=1065250&r1=1065249&r2=1065250&view=diff
==============================================================================
--- abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsResponse.java
(original)
+++ abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsResponse.java
Sun Jan 30 11:27:04 2011
@@ -143,11 +143,13 @@ public class CommonsResponse extends Abs
      * decode Content-Encodings and will automatically release the response when the stream
has been read fully.
      */
     public InputStream getInputStream() throws IOException {
-        if (in == null) {
+        String methodName = method.getName();
+        if (in == null ) {
             String ce = getHeader("Content-Encoding");
             in = method.getResponseBodyAsStream();
-            if (ce != null)
+            if (ce != null && !methodName.equalsIgnoreCase("HEAD")) {
                 in = CompressionUtil.getDecodingInputStream(in, ce);
+            }
             in = new AutoReleasingInputStream(method, in);
         }
         return in;

Added: abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/HeadTest.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/HeadTest.java?rev=1065250&view=auto
==============================================================================
--- abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/HeadTest.java (added)
+++ abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/HeadTest.java Sun
Jan 30 11:27:04 2011
@@ -0,0 +1,21 @@
+package org.apache.abdera.test.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.abdera.protocol.client.AbderaClient;
+import org.apache.abdera.protocol.client.ClientResponse;
+import org.junit.Test;
+
+public class HeadTest {
+
+    @Test
+    public void testHead() {
+        AbderaClient abderaClient = new AbderaClient();
+        ClientResponse response = abderaClient.head("http://www.heise.de/newsticker/heise-atom.xml");
+        assertNotNull(response);
+        assertEquals("HEAD", response.getMethod());
+        assertEquals(-1, response.getContentLength());
+    }
+
+}



Mime
View raw message