ws-addressing-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject svn commit: r367167 - in /webservices/addressing/trunk/src/org/apache/axis/message/addressing: AddressingHeaders.java EndpointReference.java handler/AddressingHandler.java
Date Mon, 09 Jan 2006 02:41:50 GMT
Author: gdaniels
Date: Sun Jan  8 18:41:40 2006
New Revision: 367167

URL: http://svn.apache.org/viewcvs?rev=367167&view=rev
Log:
Optionally allow non-specific (relative) Action URIs.

Also a little code cleanup.

Contributed by Jeffrey Crump from Sonic.

Modified:
    webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaders.java
    webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReference.java
    webservices/addressing/trunk/src/org/apache/axis/message/addressing/handler/AddressingHandler.java

Modified: webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaders.java
URL: http://svn.apache.org/viewcvs/webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaders.java?rev=367167&r1=367166&r2=367167&view=diff
==============================================================================
--- webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaders.java
(original)
+++ webservices/addressing/trunk/src/org/apache/axis/message/addressing/AddressingHeaders.java
Sun Jan  8 18:41:40 2006
@@ -17,6 +17,7 @@
 package org.apache.axis.message.addressing;
 
 import org.apache.axis.message.addressing.util.AddressingUtils;
+import org.apache.axis.message.addressing.util.TextExtractor;
 
 import org.apache.axis.message.MessageElement;
 import org.apache.axis.types.URI;
@@ -164,10 +165,40 @@
      * @throws Exception 
      */
     public AddressingHeaders(SOAPEnvelope env, 
+            String actorURI,
+            boolean process, 
+            boolean remove,
+            boolean setMustUnderstand,
+            List refPropsQNames)
+throws Exception {
+    	this(env,actorURI,process,remove,setMustUnderstand,false,refPropsQNames);
+    	
+    }
+    /**
+     * Constructor AddressingHeaders.
+     * 
+     * @param env       The SOAP Envelope 
+     * @param actorURI  The SOAP Actor URI
+     * @param process   Should the headers be marked as processed
+     * @param remove    Should the headers be removed after processing
+     * @param setMustUnderstand whether or not to set mustUnderstand="true" on the headers
+     * @param permitParseNonSpecificAction whether or not to allow a non-specific Action
URI
+     * @param refPropsQNames A list of QNames for reference properties. If null
+     *                       all non-WSA headers will be added as reference
+     *                       properties. If an empty list is passed
+     *                       than no headers will be added reference properties
+     *                       (default). If non empty list of qnames is passed
+     *                       then only headers matching the qname in the list
+     *                       will be added as reference properties.
+     * 
+     * @throws Exception 
+     */
+    public AddressingHeaders(SOAPEnvelope env, 
                              String actorURI,
                              boolean process, 
                              boolean remove,
                              boolean setMustUnderstand,
+                             boolean permitParseNonSpecificAction,
                              List refPropsQNames)
         throws Exception {
 
@@ -197,7 +228,8 @@
                     MessageContext msgContext = AxisEngine.getCurrentMessageContext();
                     if ( msgContext != null ) { msgContext.setProperty( Constants.ENV_ADDRESSING_NAMESPACE_URI,
name.getURI() ); }
                 } else if (localName.equals(Constants.ACTION)) {
-                    action = new Action(headerElement);
+            	    URI unspecified = new org.apache.axis.types.URI(TextExtractor.getText(headerElement),
permitParseNonSpecificAction);
+            	    action = new Action(new URI(unspecified));
                 } else if (localName.equals(Constants.FROM)) {
                     from = new From(headerElement);
                 } else if (localName.equals(Constants.REPLY_TO)) {

Modified: webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReference.java
URL: http://svn.apache.org/viewcvs/webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReference.java?rev=367167&r1=367166&r2=367167&view=diff
==============================================================================
--- webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReference.java
(original)
+++ webservices/addressing/trunk/src/org/apache/axis/message/addressing/EndpointReference.java
Sun Jan  8 18:41:40 2006
@@ -145,7 +145,7 @@
         throws Exception {
         NodeList children = element.getChildNodes();
         for (int i=0;i<children.getLength();i++) {
-            Node child = (Node)children.item(i);
+            Node child = children.item(i);
             if (child instanceof Element) {
                 if (!AddressingUtils.isAddressingNamespaceURI(child.getNamespaceURI())) {
                     // skip for now - does not currently handle extensibility elements
@@ -290,7 +290,7 @@
 
         SOAPHeader header = env.getHeader();
         if (header == null) {
-            header = env.addHeader();
+            env.addHeader();
         }
 
         Document doc = XMLUtils.newDocument();

Modified: webservices/addressing/trunk/src/org/apache/axis/message/addressing/handler/AddressingHandler.java
URL: http://svn.apache.org/viewcvs/webservices/addressing/trunk/src/org/apache/axis/message/addressing/handler/AddressingHandler.java?rev=367167&r1=367166&r2=367167&view=diff
==============================================================================
--- webservices/addressing/trunk/src/org/apache/axis/message/addressing/handler/AddressingHandler.java
(original)
+++ webservices/addressing/trunk/src/org/apache/axis/message/addressing/handler/AddressingHandler.java
Sun Jan  8 18:41:40 2006
@@ -70,6 +70,7 @@
     private String actor;
 
     private boolean removeHeaders = false;
+    private boolean allowNonSpecificActions = false;
     
     public AddressingHandler() {}
     
@@ -81,6 +82,7 @@
         initializeReferencePropertyNames();
         initializeRemoveHeaders();
         initializeActor();
+        initializeAllowNonSpecificActions();
     }
     
     protected void initializeActor() {
@@ -91,7 +93,11 @@
         String property = (String) getOption("removeHeaders");
         this.removeHeaders = "true".equalsIgnoreCase(property);
     }
-
+    
+    private void initializeAllowNonSpecificActions() {
+        String property = (String) getOption("allowNonSpecificActions");
+        this.allowNonSpecificActions = "true".equalsIgnoreCase(property);
+    }
     /**
      * Method invoke
      *
@@ -158,8 +164,8 @@
                 resHeaders.setFrom(fromEPR);
             }
         }
-
-        resHeaders.setAction(new Action(new URI(AddressingUtils.getFaultActionURI())));
+        URI actionURI = new org.apache.axis.types.URI(AddressingUtils.getFaultActionURI(),
allowNonSpecificActions);
+        resHeaders.setAction(new Action(new URI(actionURI)));
 
         // process RelatesTo
         MessageID msgID = reqHeaders.getMessageID();
@@ -186,12 +192,17 @@
             AttributedURI address = faultTo.getAddress();
             if (address != null) {
                 String uri = address.toString();
-                if (uri != null) {
+                /** Fix Sonic00027851, WS Addressing does not properly examine and deliver
to an anonymous FaultTo address */
+                 if (uri != null && !uri.equals(AddressingUtils.getAnonymousRoleURI()))
{
                     // send the msg to fault to
                     forwardMessage(faultTo, msg);
                     // Somehow make the response empty, or create a new empty
                     // response
-                    msgContext.setCurrentMessage(null);
+                    /** Fix Sonic00027691 avoid NullPointerException with msgContext.setCurrentMessage(null)*/
         
+                    if (msgContext.getPastPivot())
+                    	msgContext.setResponseMessage(null);
+                    else
+                    	msgContext.setRequestMessage(null);
                 }
             }
         }
@@ -237,7 +248,8 @@
         // set Action
         String action = msgContext.getSOAPActionURI();
         if (action != null) {
-            headers.setAction(new Action(new URI(action)));
+            URI actionURI = new org.apache.axis.types.URI(action, allowNonSpecificActions);
+            headers.setAction(new Action(new URI(actionURI)));
         } else if(headers.getAction() != null) {
             msgContext.setUseSOAPAction(true);
             // Make SOAP action match
@@ -303,6 +315,7 @@
                                   true,
                                   this.removeHeaders, 
                                   false, 
+                                  this.allowNonSpecificActions,
                                   this.refPropQNames);
         msgContext.setProperty(Constants.ENV_ADDRESSING_RESPONSE_HEADERS,
                                headers);
@@ -326,6 +339,7 @@
                                   true,
                                   this.removeHeaders,
                                   false,
+                                  this.allowNonSpecificActions,
                                   this.refPropQNames);
 
         if (headers.getTo()==null)
@@ -455,9 +469,9 @@
             // not set - try request headers
             action = reqHeaders.getAction();
             if (action != null) {
-                resHeaders.setAction(new Action(new URI(action.toString() +
-                                                        "Response")));
-            }
+                URI actionURI = new org.apache.axis.types.URI(action.toString()+"Response",
allowNonSpecificActions);
+                resHeaders.setAction(new Action(new URI(actionURI)));
+             }
         }
 
         if (resHeaders.getFrom() == null && reqHeaders.getFrom() != null) {
@@ -466,10 +480,8 @@
             resHeaders.setTo(new To(AddressingUtils.getAnonymousRoleURI()));
         }
 
-        MessageID msgID = null;
-
         // process RelatesTo
-        msgID = reqHeaders.getMessageID();
+        MessageID msgID = reqHeaders.getMessageID();
         if (msgID != null) {
             resHeaders.addRelatesTo(msgID.toString(),
                                     AddressingUtils.getResponseRelationshipType());
@@ -536,7 +548,6 @@
      * </pre>
      * 
      * @param msgContext
-     * @return
      */
     protected Service getService(MessageContext msgContext) {
         return new Service();



---------------------------------------------------------------------
To unsubscribe, e-mail: addressing-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: addressing-dev-help@ws.apache.org


Mime
View raw message