cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1127323 - in /cxf/trunk: rt/transports/common/src/main/java/org/apache/cxf/transport/common/gzip/ rt/transports/local/src/main/java/org/apache/cxf/transport/local/ systests/transports/src/test/java/org/apache/cxf/systest/local_transport/
Date Tue, 24 May 2011 22:40:43 GMT
Author: dkulp
Date: Tue May 24 22:40:42 2011
New Revision: 1127323

URL: http://svn.apache.org/viewvc?rev=1127323&view=rev
Log:
[CXF-3545] Use the "correct" streams when copying content in direct
dispatch mode.

Modified:
    cxf/trunk/rt/transports/common/src/main/java/org/apache/cxf/transport/common/gzip/GZIPOutInterceptor.java
    cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
    cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/local_transport/DirectDispatchClientTest.java
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/local_transport/Server.java

Modified: cxf/trunk/rt/transports/common/src/main/java/org/apache/cxf/transport/common/gzip/GZIPOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/common/src/main/java/org/apache/cxf/transport/common/gzip/GZIPOutInterceptor.java?rev=1127323&r1=1127322&r2=1127323&view=diff
==============================================================================
--- cxf/trunk/rt/transports/common/src/main/java/org/apache/cxf/transport/common/gzip/GZIPOutInterceptor.java
(original)
+++ cxf/trunk/rt/transports/common/src/main/java/org/apache/cxf/transport/common/gzip/GZIPOutInterceptor.java
Tue May 24 22:40:42 2011
@@ -106,6 +106,11 @@ public class GZIPOutInterceptor extends 
         super(Phase.PREPARE_SEND);
         addAfter(MessageSenderInterceptor.class.getName());
     }
+    public GZIPOutInterceptor(int threshold) {
+        super(Phase.PREPARE_SEND);
+        addAfter(MessageSenderInterceptor.class.getName());
+        this.threshold = threshold;
+    }
 
     public void setThreshold(int threshold) {
         this.threshold = threshold;

Modified: cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java?rev=1127323&r1=1127322&r2=1127323&view=diff
==============================================================================
--- cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
(original)
+++ cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
Tue May 24 22:40:42 2011
@@ -93,9 +93,11 @@ public class LocalConduit extends Abstra
         
         OutputStream out = message.getContent(OutputStream.class);
         out.flush();
+        out.close();
         
         CachedOutputStream stream = message.get(CachedOutputStream.class);
         copy.setContent(InputStream.class, stream.getInputStream());
+        copy.removeContent(CachedOutputStream.class);
 
         // Create a new incoming exchange and store the original exchange for the response
         ExchangeImpl ex = new ExchangeImpl();

Modified: cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java?rev=1127323&r1=1127322&r2=1127323&view=diff
==============================================================================
--- cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
(original)
+++ cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
Tue May 24 22:40:42 2011
@@ -120,6 +120,7 @@ public class LocalDestination extends Ab
             } else {
                 CachedOutputStream stream = new CachedOutputStream();
                 message.setContent(OutputStream.class, stream);
+                message.setContent(CachedOutputStream.class, stream);
             }
         }
 
@@ -130,8 +131,10 @@ public class LocalDestination extends Ab
                 
                 MessageImpl copy = new MessageImpl();
                 copy.putAll(message);
+                message.getContent(OutputStream.class).close();
+                CachedOutputStream stream = message.getContent(CachedOutputStream.class);
+                message.setContent(OutputStream.class, stream);
                 MessageImpl.copyContent(message, copy);
-                CachedOutputStream stream = (CachedOutputStream)message.getContent(OutputStream.class);
                 copy.setContent(InputStream.class, stream.getInputStream());
                 if (exchange != null && exchange.getInMessage() == null) {
                     exchange.setInMessage(copy);

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/local_transport/DirectDispatchClientTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/local_transport/DirectDispatchClientTest.java?rev=1127323&r1=1127322&r2=1127323&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/local_transport/DirectDispatchClientTest.java
(original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/local_transport/DirectDispatchClientTest.java
Tue May 24 22:40:42 2011
@@ -30,7 +30,11 @@ import javax.xml.ws.Service;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.transport.common.gzip.GZIPInInterceptor;
+import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor;
 import org.apache.cxf.transport.local.LocalConduit;
 import org.apache.hello_world_soap_http.Greeter;
 
@@ -71,6 +75,9 @@ public class DirectDispatchClientTest ex
         Greeter greeter = service.getPort(localPortName, Greeter.class);
         
         if (isDirectDispatch) {
+            Client client = ClientProxy.getClient(greeter);
+            client.getOutInterceptors().add(new GZIPOutInterceptor(50));
+            client.getInInterceptors().add(new GZIPInInterceptor());
             InvocationHandler handler  = Proxy.getInvocationHandler(greeter);
             BindingProvider  bp = null;
             if (handler instanceof BindingProvider) {

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/local_transport/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/local_transport/Server.java?rev=1127323&r1=1127322&r2=1127323&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/local_transport/Server.java
(original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/local_transport/Server.java
Tue May 24 22:40:42 2011
@@ -19,10 +19,12 @@
 
 package org.apache.cxf.systest.local_transport;
 
+import javax.jws.WebService;
 import javax.xml.ws.Endpoint;
 
+import org.apache.cxf.annotations.GZIP;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
-import org.apache.hello_world_soap_http.GreeterImpl;
+import org.apache.hello_world_soap_http.BaseGreeterImpl;
 
 public class Server extends AbstractBusTestServerBase {
 
@@ -44,5 +46,17 @@ public class Server extends AbstractBusT
             System.out.println("done!");
         }
     }
+    
+
+    @WebService(serviceName = "SOAPService",
+                portName = "SoapPort",
+                endpointInterface = "org.apache.hello_world_soap_http.Greeter",
+                targetNamespace = "http://apache.org/hello_world_soap_http",
+                wsdlLocation = "testutils/hello_world.wsdl")
+    @GZIP(threshold = 50)            
+    public class GreeterImpl extends BaseGreeterImpl {
+
+
+    }
 }
 



Mime
View raw message