cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r965483 - in /cxf/branches/2.2.x-fixes: ./ rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
Date Mon, 19 Jul 2010 13:52:47 GMT
Author: dkulp
Date: Mon Jul 19 13:52:47 2010
New Revision: 965483

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

........
  r959993 | ema | 2010-07-02 10:12:58 -0400 (Fri, 02 Jul 2010) | 1 line
  
  [CXF-2867]:Skip wsa policy verification when client proxy is created with AddressingFeature(required=false)
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java

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

Modified: cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java?rev=965483&r1=965482&r2=965483&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
Mon Jul 19 13:52:47 2010
@@ -40,6 +40,7 @@ import org.apache.cxf.common.i18n.Bundle
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.OneWayProcessorInterceptor;
@@ -300,7 +301,49 @@ public class MAPAggregator extends Abstr
         } 
         return false;
     }
-    
+
+   
+    private WSAddressingFeature getWSAddressingFeature(Message message) {
+        if (message.getExchange() != null && message.getExchange().getEndpoint()
!= null) {
+            Endpoint endpoint = message.getExchange().getEndpoint();
+            if (endpoint.getActiveFeatures() != null) {
+                for (AbstractFeature feature : endpoint.getActiveFeatures()) {
+                    if (feature instanceof WSAddressingFeature) {
+                        return (WSAddressingFeature)feature;
+                    }
+                }
+            }
+        }
+        return null;
+    }
+    /**
+     * If the isRequestor(message) == true and isAddressRequired() == false
+     * Assert all the wsa related assertion to true
+     * 
+     * @param message the current message
+     */
+    private void assertAddressing(Message message) {
+        AssertionInfoMap aim = message.get(AssertionInfoMap.class);
+        if (null == aim) {
+            return;
+        }
+        QName[] types = new QName[] {
+            MetadataConstants.ADDRESSING_ASSERTION_QNAME, MetadataConstants.USING_ADDRESSING_2004_QNAME,
+            MetadataConstants.USING_ADDRESSING_2005_QNAME, MetadataConstants.USING_ADDRESSING_2006_QNAME
+        };
+
+        for (QName type : types) {
+            assertAssertion(aim, type);
+            if (type.equals(MetadataConstants.ADDRESSING_ASSERTION_QNAME)) {
+                assertAssertion(aim, MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME);
+                assertAssertion(aim, MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME);
+            } else if (type.equals(MetadataConstants.ADDRESSING_ASSERTION_QNAME_0705)) {
+                assertAssertion(aim, MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME_0705);
+                assertAssertion(aim, MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME_0705);
+            }
+        }
+    }
+
     /**
      * Asserts all Addressing assertions for the current message, regardless their nested

      * Policies.
@@ -468,6 +511,13 @@ public class MAPAggregator extends Abstr
             if (null != theMaps) {            
                 assertAddressing(message, theMaps.getReplyTo(), theMaps.getFaultTo());
             }
+            // If the wsa policy is enabled , but the client sets the
+            // WSAddressingFeature.isAddressingRequired to false , we need to assert all
WSA assertion to true
+            if (!ContextUtils.isOutbound(message) && ContextUtils.isRequestor(message)
+                && getWSAddressingFeature(message) != null
+                && !getWSAddressingFeature(message).isAddressingRequired()) {
+                assertAddressing(message);
+            }
         }
         return continueProcessing;
     }



Mime
View raw message