cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r551333 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/io/ api/src/main/java/org/apache/cxf/phase/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/ rt/t...
Date Wed, 27 Jun 2007 21:14:40 GMT
Author: dkulp
Date: Wed Jun 27 14:14:37 2007
New Revision: 551333

URL: http://svn.apache.org/viewvc?view=rev&rev=551333
Log:
Remove some deprecated code
Make bstractWrappedOutputStream delegate flush() and close() methods to wrapped stream
Make HTTPConduit properly close the output stream
Make HTTPConduit slurp off some unread data from input stream before closing it

Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/io/AbstractWrappedOutputStream.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerInterceptor.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/io/AbstractWrappedOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/io/AbstractWrappedOutputStream.java?view=diff&rev=551333&r1=551332&r2=551333
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/io/AbstractWrappedOutputStream.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/io/AbstractWrappedOutputStream.java
Wed Jun 27 14:14:37 2007
@@ -65,5 +65,18 @@
         }
         wrappedStream.write(b);
     }
+    
+    @Override
+    public void close() throws IOException {
+        if (wrappedStream != null) {
+            wrappedStream.close();
+        }
+    }
 
+    @Override
+    public void flush() throws IOException {
+        if (written) {
+            wrappedStream.flush();
+        }
+    }
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java?view=diff&rev=551333&r1=551332&r2=551333
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java
Wed Jun 27 14:14:37 2007
@@ -28,17 +28,10 @@
 
 public abstract class AbstractPhaseInterceptor<T extends Message> implements PhaseInterceptor<T>
{
     private final String id;
-    private String phase;
+    private final String phase;
     private final Set<String> before = new SortedArraySet<String>();
     private final Set<String> after = new SortedArraySet<String>();
 
-    /**
-     * @deprecated
-     */
-    public AbstractPhaseInterceptor() {
-        this(null, null);
-    }
-    
     public AbstractPhaseInterceptor(String phase) {
         this(null, phase);
     }
@@ -73,14 +66,6 @@
         return phase;
     }
 
-    /*
-     * REVISIT: Not sure why this was deprecated, need to reset Phase especially
-     * when same interceptor is added into inbound and outbound chain, thus need
-     * different Phases.
-     */
-    public void setPhase(String p) {
-        this.phase = p;
-    }
 
     public void handleFault(T message) {
     }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?view=diff&rev=551333&r1=551332&r2=551333
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
Wed Jun 27 14:14:37 2007
@@ -271,8 +271,8 @@
             if (endpoint.getBinding() instanceof SoapBinding) {
                 chain.add(new DispatchSOAPHandlerInterceptor(jaxwsBinding));
             }      
-            DispatchLogicalHandlerInterceptor slhi = new DispatchLogicalHandlerInterceptor(jaxwsBinding);
-            slhi.setPhase(Phase.USER_LOGICAL);            
+            DispatchLogicalHandlerInterceptor slhi 
+                = new DispatchLogicalHandlerInterceptor(jaxwsBinding, Phase.USER_LOGICAL);
           
             chain.add(slhi);
         }           
 

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerInterceptor.java?view=diff&rev=551333&r1=551332&r2=551333
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerInterceptor.java
Wed Jun 27 14:14:37 2007
@@ -38,6 +38,9 @@
     public DispatchLogicalHandlerInterceptor(Binding binding) {
         super(binding, Phase.PRE_MARSHAL);
     }
+    public DispatchLogicalHandlerInterceptor(Binding binding, String phase) {
+        super(binding, phase);
+    }
     
     public void handleMessage(T message) throws Fault {
         HandlerChainInvoker invoker = getInvoker(message);

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?view=diff&rev=551333&r1=551332&r2=551333
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Wed Jun 27 14:14:37 2007
@@ -160,6 +160,11 @@
      * Endpoint Qname to give the configuration name of this conduit.
      */
     private static final String SC_HTTP_CONDUIT_SUFFIX = ".http-conduit";
+    
+    /**
+     * Buffer to use to suck unread bytes off of input streams
+     */
+    private static final byte BUFFER[] = new byte[1024];
 
 
     /**
@@ -512,8 +517,8 @@
                 && !needToCacheRequest) {
                 //TODO: The chunking mode be configured or at least some
                 // documented client constant.
-                LOG.log(Level.FINER, "Chunking is set at 2048.");
-                connection.setChunkedStreamingMode(2048);
+                //use -1 and allow the URL connection to pick a default value
+                connection.setChunkedStreamingMode(-1);
             }
         }
         
@@ -546,6 +551,25 @@
         // We are now "ready" to "send" the message. 
     }
     
+    public void close(Message msg) throws IOException {
+        InputStream in = msg.getContent(InputStream.class);
+        try {
+            if (in != null) {
+                int count = 0;
+                while (in.read(BUFFER) != -1
+                    && count < 25) {
+                    //don't do anything, we just need to pull off the unread data (like
+                    //closing tags that we didn't need to read
+                    
+                    //however, limit it so we don't read off gigabytes of data we won't use.
+                    ++count;
+                }
+            } 
+        } finally {
+            super.close(msg);
+        }
+    }
+
     /**
      * This call must take place before anything is written to the 
      * URLConnection. The URLConnection.connect() will be called in order 
@@ -1695,8 +1719,8 @@
             if (!written) {
                 handleHeadersTrustCaching();
             }
-            handleResponse();
             super.close();
+            handleResponse();
         }
         
         

Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java?view=diff&rev=551333&r1=551332&r2=551333
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
Wed Jun 27 14:14:37 2007
@@ -212,7 +212,7 @@
             if (!autoRedirect) {
                 connection.getRequestMethod();
                 EasyMock.expectLastCall().andReturn("POST");
-                connection.setChunkedStreamingMode(2048);
+                connection.setChunkedStreamingMode(-1);
                 EasyMock.expectLastCall();                    
             }
 



Mime
View raw message