Add a check for gzi in to make sure not for GET.

Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/14d8f97c
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/14d8f97c
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/14d8f97c

Branch: refs/heads/2.7.x-fixes
Commit: 14d8f97c5c0a26beee3f253531757d89310587f8
Parents: 900e9ad
Author: Daniel Kulp <[email protected]>
Authored: Tue May 13 14:44:28 2014 -0400
Committer: Daniel Kulp <[email protected]>
Committed: Tue May 13 15:06:10 2014 -0400

----------------------------------------------------------------------
 .../cxf/transport/common/gzip/GZIPInInterceptor.java  |  3 +++
 .../cxf/systest/jaxrs/JAXRSClientServerBookTest.java  | 14 ++++++++++++++
 2 files changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/14d8f97c/rt/core/src/main/java/org/apache/cxf/transport/common/gzip/GZIPInInterceptor.java
----------------------------------------------------------------------
diff --git 
a/rt/core/src/main/java/org/apache/cxf/transport/common/gzip/GZIPInInterceptor.java
 
b/rt/core/src/main/java/org/apache/cxf/transport/common/gzip/GZIPInInterceptor.java
index 0ad1be2..a0772e7 100644
--- 
a/rt/core/src/main/java/org/apache/cxf/transport/common/gzip/GZIPInInterceptor.java
+++ 
b/rt/core/src/main/java/org/apache/cxf/transport/common/gzip/GZIPInInterceptor.java
@@ -60,6 +60,9 @@ public class GZIPInInterceptor extends 
AbstractPhaseInterceptor<Message> {
     }
 
     public void handleMessage(Message message) throws Fault {
+        if (isGET(message)) {
+            return;
+        }
         // check for Content-Encoding header - we are only interested in
         // messages that say they are gzipped.
         Map<String, List<String>> protocolHeaders = CastUtils.cast((Map<?, 
?>)message

http://git-wip-us.apache.org/repos/asf/cxf/blob/14d8f97c/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
----------------------------------------------------------------------
diff --git 
a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
 
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
index b0575bf..b53f6f1 100644
--- 
a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
+++ 
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
@@ -33,6 +33,7 @@ import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.zip.GZIPInputStream;
 
 import javax.ws.rs.NotAcceptableException;
 import javax.ws.rs.ServerErrorException;
@@ -100,6 +101,19 @@ public class JAXRSClientServerBookTest extends 
AbstractBusClientServerTestBase {
         assertEquals(124L, book.getId());
         assertEquals("root", book.getName());
     }
+    @Test
+    public void testGetBookQueryGZIP() throws Exception {
+        String address = "http://localhost:"; + PORT + "/bookstore/";
+        WebClient wc = WebClient.create(address);
+        wc.acceptEncoding("gzip,deflate");
+        wc.encoding("gzip");
+        InputStream r = wc.get(InputStream.class);
+        assertNotNull(r);
+        GZIPInputStream in = new GZIPInputStream(r);
+        String s = IOUtils.toString(in);
+        in.close();
+        assertTrue(s, s.contains("id>124"));
+    }
     
     @Test
     public void testGetBookQueryDefault() throws Exception {

Reply via email to