You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2009/09/19 13:54:33 UTC

svn commit: r816897 - in /cxf/branches/2.2.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/attachment/DelegatingInputStream.java rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java

Author: dkulp
Date: Sat Sep 19 11:54:32 2009
New Revision: 816897

URL: http://svn.apache.org/viewvc?rev=816897&view=rev
Log:
Merged revisions 816894 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r816894 | dkulp | 2009-09-19 07:41:09 -0400 (Sat, 19 Sep 2009) | 1 line
  
  [CXF-2440] Fix some interaction problems with gzip and mtom
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/DelegatingInputStream.java
    cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/DelegatingInputStream.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/DelegatingInputStream.java?rev=816897&r1=816896&r2=816897&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/DelegatingInputStream.java (original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/DelegatingInputStream.java Sat Sep 19 11:54:32 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/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java?rev=816897&r1=816896&r2=816897&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java (original)
+++ cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/gzip/GZIPInInterceptor.java Sat Sep 19 11:54:32 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);
-        }
-    }
 }