axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r384382 - /webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
Date Thu, 09 Mar 2006 00:00:49 GMT
Author: dims
Date: Wed Mar  8 16:00:47 2006
New Revision: 384382

URL: http://svn.apache.org/viewcvs?rev=384382&view=rev
Log:
check all the addressing headers *first* since if the faultto gets set up to a non-anonymous
endpoint then that causes problems

Modified:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java?rev=384382&r1=384381&r2=384382&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
Wed Mar  8 16:00:47 2006
@@ -87,43 +87,51 @@
         Options messageContextOptions = messageContext.getOptions();
         Map alreadyFoundAddrHeader = new HashMap(7); // there are seven frequently used WS-A
headers
 
+        // First pass just check for duplicates
         Iterator addressingHeadersIt = addressingHeaders.iterator();
         while (addressingHeadersIt.hasNext()) {
             SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) addressingHeadersIt.next();
-
             if (SOAP12Constants.SOAP_ROLE_NONE.equals(soapHeaderBlock.getRole()))
                 continue;
+            if (WSA_TO.equals(soapHeaderBlock.getLocalName())) {
+                checkDuplicateHeaders(WSA_TO, messageContext, alreadyFoundAddrHeader);
+            } else if (WSA_FROM.equals(soapHeaderBlock.getLocalName())) {
+                checkDuplicateHeaders(WSA_FROM, messageContext, alreadyFoundAddrHeader);
+            } else if (WSA_REPLY_TO.equals(soapHeaderBlock.getLocalName())) {
+                checkDuplicateHeaders(WSA_REPLY_TO, messageContext, alreadyFoundAddrHeader);
+            } else if (WSA_FAULT_TO.equals(soapHeaderBlock.getLocalName())) {
+                checkDuplicateHeaders(WSA_FAULT_TO, messageContext, alreadyFoundAddrHeader);
+            } else if (WSA_MESSAGE_ID.equals(soapHeaderBlock.getLocalName())) {
+                checkDuplicateHeaders(WSA_MESSAGE_ID, messageContext, alreadyFoundAddrHeader);
+            } else if (WSA_ACTION.equals(soapHeaderBlock.getLocalName())) {
+                checkDuplicateHeaders(WSA_ACTION, messageContext, alreadyFoundAddrHeader);
+            } else if (WSA_RELATES_TO.equals(soapHeaderBlock.getLocalName())) {
+                checkDuplicateHeaders(WSA_RELATES_TO, messageContext, alreadyFoundAddrHeader);
+            }
+        }
 
+        // Now extract information
+        Iterator addressingHeadersIt2 = addressingHeaders.iterator();
+        while (addressingHeadersIt2.hasNext()) {
+            SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) addressingHeadersIt2.next();
+            if (SOAP12Constants.SOAP_ROLE_NONE.equals(soapHeaderBlock.getRole()))
+                continue;
             if (WSA_TO.equals(soapHeaderBlock.getLocalName())) {
-                if (!hasDuplicateHeaders(WSA_TO, messageContext, alreadyFoundAddrHeader))
{
-                    extractToEPRInformation(soapHeaderBlock, messageContextOptions, header);
-                }
+                extractToEPRInformation(soapHeaderBlock, messageContextOptions, header);
             } else if (WSA_FROM.equals(soapHeaderBlock.getLocalName())) {
-                if (!hasDuplicateHeaders(WSA_FROM, messageContext, alreadyFoundAddrHeader))
{
-                    extractFromEPRInformation(messageContextOptions, soapHeaderBlock, addressingNamespace);
-                }
+                extractFromEPRInformation(messageContextOptions, soapHeaderBlock, addressingNamespace);
             } else if (WSA_REPLY_TO.equals(soapHeaderBlock.getLocalName())) {
-                if (!hasDuplicateHeaders(WSA_REPLY_TO, messageContext, alreadyFoundAddrHeader))
{
-                    extractReplyToEPRInformation(messageContextOptions, soapHeaderBlock,
addressingNamespace);
-                }
+                extractReplyToEPRInformation(messageContextOptions, soapHeaderBlock, addressingNamespace);
             } else if (WSA_FAULT_TO.equals(soapHeaderBlock.getLocalName())) {
-                if (!hasDuplicateHeaders(WSA_FAULT_TO, messageContext, alreadyFoundAddrHeader))
{
-                    extractFaultToEPRInformation(messageContextOptions, soapHeaderBlock,
addressingNamespace);
-                }
+                extractFaultToEPRInformation(messageContextOptions, soapHeaderBlock, addressingNamespace);
             } else if (WSA_MESSAGE_ID.equals(soapHeaderBlock.getLocalName())) {
-                if (!hasDuplicateHeaders(WSA_MESSAGE_ID, messageContext, alreadyFoundAddrHeader))
{
-                    messageContextOptions.setMessageId(soapHeaderBlock.getText());
-                    soapHeaderBlock.setProcessed();
-                }
+                messageContextOptions.setMessageId(soapHeaderBlock.getText());
+                soapHeaderBlock.setProcessed();
             } else if (WSA_ACTION.equals(soapHeaderBlock.getLocalName())) {
-                if (!hasDuplicateHeaders(WSA_ACTION, messageContext, alreadyFoundAddrHeader))
{
-                    messageContextOptions.setAction(soapHeaderBlock.getText());
-                    soapHeaderBlock.setProcessed();
-                }
+                messageContextOptions.setAction(soapHeaderBlock.getText());
+                soapHeaderBlock.setProcessed();
             } else if (WSA_RELATES_TO.equals(soapHeaderBlock.getLocalName())) {
-                if (!hasDuplicateHeaders(WSA_RELATES_TO, messageContext, alreadyFoundAddrHeader))
{
-                    extractRelatesToInformation(soapHeaderBlock, addressingNamespace, messageContextOptions);
-                }
+                extractRelatesToInformation(soapHeaderBlock, addressingNamespace, messageContextOptions);
             }
         }
 
@@ -139,7 +147,7 @@
         } 
     }
 
-    private boolean hasDuplicateHeaders(String addressingHeaderName, MessageContext messageContext,
Map alreadyFoundAddressingHeaders) throws AxisFault {
+    private boolean checkDuplicateHeaders(String addressingHeaderName, MessageContext messageContext,
Map alreadyFoundAddressingHeaders) throws AxisFault {
         if (alreadyFoundAddressingHeaders.get(addressingHeaderName) != null) {
             throwFault(messageContext, addressingHeaderName, Final.FAULT_INVALID_HEADER,
Final.FAULT_INVALID_CARDINALITY);
         } else {



Mime
View raw message