cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From egl...@apache.org
Subject svn commit: r718567 - in /cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/ systests/src/test/java/org/apache/cxf/systest/ws/security/
Date Tue, 18 Nov 2008 12:52:37 GMT
Author: eglynn
Date: Tue Nov 18 04:52:36 2008
New Revision: 718567

URL: http://svn.apache.org/viewvc?rev=718567&view=rev
Log:
Further fix for scenario with both SAAJOutInterceptor and JAX-WS SOAPHandlers present on the
out-interceptor chain.


Modified:
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/TestOutHandler.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/WSSecurityClientTest.java

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java?rev=718567&r1=718566&r2=718567&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
Tue Nov 18 04:52:36 2008
@@ -112,11 +112,9 @@
 
         if (getInvoker(message).isOutbound()) {
             if (!chainAlreadyContainsSAAJ(message)) {
-
                 SAAJ_OUT.handleMessage(message);
-
-                message.getInterceptorChain().add(ending);
             }
+            message.getInterceptorChain().add(ending);
         } else {
             boolean isFault = handleMessageInternal(message);
             SOAPMessage msg = message.getContent(SOAPMessage.class);

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/TestOutHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/TestOutHandler.java?rev=718567&r1=718566&r2=718567&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/TestOutHandler.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/TestOutHandler.java
Tue Nov 18 04:52:36 2008
@@ -27,6 +27,9 @@
 import javax.xml.ws.handler.soap.SOAPMessageContext;
 
 public class TestOutHandler implements SOAPHandler<SOAPMessageContext> {
+    boolean handleFaultCalledOutbound;
+    boolean handleMessageCalledOutbound;
+
     public Set<QName> getHeaders() {
         return null;
     }
@@ -35,11 +38,22 @@
     }
 
     public boolean handleFault(SOAPMessageContext smc) {
+        if (isOutbound(smc)) {
+            handleFaultCalledOutbound = true;
+        }
         return true;
     }
 
     public boolean handleMessage(SOAPMessageContext smc) {
+        if (isOutbound(smc)) {
+            handleMessageCalledOutbound = true;
+        }
         return true;
     }
 
+    private static boolean isOutbound(SOAPMessageContext smc) {
+        return smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY) != null 
+               && ((Boolean)smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)).booleanValue();
+    }
+ 
 }

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/WSSecurityClientTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/WSSecurityClientTest.java?rev=718567&r1=718566&r2=718567&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/WSSecurityClientTest.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/WSSecurityClientTest.java
Tue Nov 18 04:52:36 2008
@@ -112,12 +112,16 @@
         //
         List<Handler> handlerChain = new ArrayList<Handler>();
         Binding binding = ((BindingProvider)greeter).getBinding();
-        Handler handler;
-        handler = new TestOutHandler();
+        TestOutHandler handler = new TestOutHandler();
         handlerChain.add(handler);
         binding.setHandlerChain(handlerChain);
 
         greeter.sayHi();
+
+        assertTrue("expected Handler.handleMessage() to be called", 
+                   handler.handleMessageCalledOutbound);
+        assertFalse("expected Handler.handleFault() not to be called", 
+                    handler.handleFaultCalledOutbound); 
     }
 
     @Test



Mime
View raw message