cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r816894 - in /cxf/trunk/rt: core/src/main/java/org/apache/cxf/attachment/DelegatingInputStream.java transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java
Date Sat, 19 Sep 2009 11:41:10 GMT
Author: dkulp
Date: Sat Sep 19 11:41:09 2009
New Revision: 816894

URL: http://svn.apache.org/viewvc?rev=816894&view=rev
Log:
[CXF-2440] Fix some interaction problems with gzip and mtom

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/DelegatingInputStream.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/DelegatingInputStream.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/DelegatingInputStream.java?rev=816894&r1=816893&r2=816894&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/DelegatingInputStream.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/DelegatingInputStream.java Sat
Sep 19 11:41:09 2009
@@ -39,10 +39,10 @@
     @Override
     public void close() throws IOException {
         is.close();
-        isClosed = true;
         if (!isClosed) {
             deserializer.markClosed(this);
         }
+        isClosed = true;
     }
 
     public boolean isClosed() {

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java?rev=816894&r1=816893&r2=816894&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java
Sat Sep 19 11:41:09 2009
@@ -51,22 +51,10 @@
  */
 public class GZIPInInterceptor extends AbstractPhaseInterceptor<Message> {
 
-    /**
-     * Key under which we store the original input stream on the message, for
-     * use by the ending interceptor.
-     */
-    public static final String ORIGINAL_INPUT_STREAM_KEY = GZIPInInterceptor.class.getName()
-                                                           + ".originalInputStream";
 
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(GZIPInInterceptor.class);
     private static final Logger LOG = LogUtils.getL7dLogger(GZIPInInterceptor.class);
 
-    /**
-     * Ending interceptor that restores the original input stream on the message
-     * when we have finished unzipping it.
-     */
-    private GZIPInEndingInterceptor ending = new GZIPInEndingInterceptor();
-
     public GZIPInInterceptor() {
         super(Phase.RECEIVE);
         addBefore(AttachmentInInterceptor.class.getName());
@@ -84,11 +72,7 @@
                 && (contentEncoding.contains("gzip") || contentEncoding.contains("x-gzip")))
{
                 try {
                     LOG.fine("Uncompressing response");
-                    // remember the original input stream, the ending
-                    // interceptor
-                    // will use it later
                     InputStream is = message.getContent(InputStream.class);
-                    message.put(ORIGINAL_INPUT_STREAM_KEY, is);
 
                     // wrap an unzipping stream around the original one
                     GZIPInputStream zipInput = new GZIPInputStream(is);
@@ -101,9 +85,6 @@
                             break;
                         }
                     }
-
-                    // add the ending interceptor
-                    message.getInterceptorChain().add(ending);
                 } catch (IOException ex) {
                     throw new Fault(new org.apache.cxf.common.i18n.Message("COULD_NOT_UNZIP",
BUNDLE), ex);
                 }
@@ -111,21 +92,4 @@
         }
     }
 
-    /**
-     * Ending interceptor to restore the original input stream after processing,
-     * so as not to interfere with streaming HTTP.
-     */
-    public class GZIPInEndingInterceptor extends AbstractPhaseInterceptor<Message>
{
-        public GZIPInEndingInterceptor() {
-            super(Phase.POST_INVOKE);
-        }
-
-        /**
-         * Restores the original input stream for the message.
-         */
-        public void handleMessage(Message message) throws Fault {
-            InputStream originalIn = (InputStream)message.get(ORIGINAL_INPUT_STREAM_KEY);
-            message.setContent(InputStream.class, originalIn);
-        }
-    }
 }



Mime
View raw message