Repository: cxf Updated Branches: refs/heads/master 17407dbb8 -> 54b617b84
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/54b617b8 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/54b617b8 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/54b617b8 Branch: refs/heads/master Commit: 54b617b8481ff5964dd864a9f24e865cfc6ca7ab Parents: 17407db Author: Daniel Kulp <[email protected]> Authored: Tue May 13 14:44:28 2014 -0400 Committer: Daniel Kulp <[email protected]> Committed: Tue May 13 14:48:35 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/54b617b8/core/src/main/java/org/apache/cxf/transport/common/gzip/GZIPInInterceptor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/cxf/transport/common/gzip/GZIPInInterceptor.java b/core/src/main/java/org/apache/cxf/transport/common/gzip/GZIPInInterceptor.java index 0ad1be2..a0772e7 100644 --- a/core/src/main/java/org/apache/cxf/transport/common/gzip/GZIPInInterceptor.java +++ b/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/54b617b8/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 42abdc9..0a0048e 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.ProcessingException; @@ -102,6 +103,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 {
