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/08/04 19:20:56 UTC

svn commit: r800880 - in /cxf/trunk: rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java

Author: dkulp
Date: Tue Aug  4 17:20:56 2009
New Revision: 800880

URL: http://svn.apache.org/viewvc?rev=800880&view=rev
Log:
[CXF-2379] Require endpoints to declare which mustUnderstand headers
they want to process

Modified:
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java

Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java?rev=800880&r1=800879&r2=800880&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java (original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java Tue Aug  4 17:20:56 2009
@@ -89,10 +89,7 @@
             .add(new UltimateReceiverMustUnderstandInterceptor(mustUnderstandQNames));
         Object o = soapMessage.getContextualProperty("endpoint-processes-headers");
         if (o == null) {
-            //The default here really should be to make o = "" and process
-            //so any mustUnderstands are kill immediately. That will break
-            //existing apps though.  Thus, it's a migration issue.
-            return;
+            o = Collections.EMPTY_LIST;
         }
         Collection<Object> o2;
         if (o instanceof Collection) {
@@ -109,7 +106,8 @@
             }
             Iterator<Header> hit = ultimateReceiverHeaders.iterator();
             while (hit.hasNext()) {
-                if (qn.equals(hit.next().getName())) {
+                Header h = hit.next();
+                if (qn.equals(h.getName())) {
                     hit.remove();
                 }
             }
@@ -117,10 +115,14 @@
         if (!ultimateReceiverHeaders.isEmpty()) {
             Set<QName> notFound = new HashSet<QName>();
             for (Header h : ultimateReceiverHeaders) {
-                notFound.add(h.getName());
+                if (!mustUnderstandQNames.contains(h.getName())) {
+                    notFound.add(h.getName());
+                }
             }
-            throw new SoapFault(new Message("MUST_UNDERSTAND", BUNDLE, notFound),
+            if (!notFound.isEmpty()) {
+                throw new SoapFault(new Message("MUST_UNDERSTAND", BUNDLE, notFound),
                                 soapMessage.getVersion().getMustUnderstand());
+            }
         }
     }
     private void initServiceSideInfo(Set<QName> mustUnderstandQNames, SoapMessage soapMessage,

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java?rev=800880&r1=800879&r2=800880&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/outofband/header/OOBHeaderTest.java Tue Aug  4 17:20:56 2009
@@ -183,7 +183,7 @@
         priceData.setTickerPrice(1.0f);
         priceData.setTickerSymbol("CELTIX");
 
-        assertTrue(check(0, putLastTradedPrice, false, true, priceData));
+        assertFalse(check(0, putLastTradedPrice, false, true, priceData));
         assertFalse(check(1, putLastTradedPrice, false, true, priceData));
         assertTrue(check(2, putLastTradedPrice, false, true, priceData));