You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2007/04/04 11:36:56 UTC

svn commit: r525477 - in /webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2: Constants.java transport/RequestResponseTransport.java transport/http/AbstractHTTPSender.java transport/http/AxisServlet.java transport/http/HTTPWorker.java

Author: chamikara
Date: Wed Apr  4 02:36:53 2007
New Revision: 525477

URL: http://svn.apache.org/viewvc?view=rev&rev=525477
Log:
Added two changes to the branch

1.
Currently when we send messages out using the HTTP transport, it is 
checked weather a MessageContext object has been set for the 'In' entry 
of the OperationContext. If this is present transport information is 
saved there, else they are ignored. In Sandesha2 we have a scenario where 
this MessageContext is not present in the operation context (the incoming 
message may be a Acknowledgement which should not be added to the OpCtx of 
the application message). So we Axis2 to preserve the transport information 
even when MsgCtx is not set.
This was needed to keep Sandesha2+MTOM working for the 1.2 release

2.
Added a new method named 'signalFaultReady' to the RequestResponseTransport object. 
This will basially ask the Transport to end a current wait throwing the given fault. 




Modified:
    webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/Constants.java
    webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/RequestResponseTransport.java
    webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
    webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
    webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java

Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/Constants.java?view=diff&rev=525477&r1=525476&r2=525477
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/Constants.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/Constants.java Wed Apr  4 02:36:53 2007
@@ -321,6 +321,11 @@
         public static final String MESSAGE_TYPE = "messageType";
 
         public static final String SOAP_RESPONSE_MEP = "soapResponseMEP";
+        
+        /**
+         * This will be used as a key for storing transport information.
+         */
+        public static final String TRANSPORT_INFO_MAP = "TransportInfoMap";
 
     }
 }

Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/RequestResponseTransport.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/RequestResponseTransport.java?view=diff&rev=525477&r1=525476&r2=525477
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/RequestResponseTransport.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/RequestResponseTransport.java Wed Apr  4 02:36:53 2007
@@ -59,7 +59,7 @@
      *
      * @throws InterruptedException
      */
-    public void awaitResponse() throws InterruptedException;
+    public void awaitResponse() throws InterruptedException, AxisFault;
 
     /**
      * Signal that a response has be created and is ready for transmission.  This
@@ -67,6 +67,12 @@
      */
     public void signalResponseReady();
 
+    /**
+     * This will tell the transport to end a current wait by raising the given fault.
+     * @param fault The fault to be raised.
+     */
+    public void signalFaultReady(AxisFault fault);
+    
     /**
      * This gives the current status of an RequestResponseTransport object.
      *

Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java?view=diff&rev=525477&r1=525476&r2=525477
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java Wed Apr  4 02:36:53 2007
@@ -49,6 +49,7 @@
 import java.io.InputStream;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -217,19 +218,31 @@
             MessageContext inMessageContext = msgContext.getOperationContext().getMessageContext(
                     WSDLConstants.MESSAGE_LABEL_IN_VALUE);
 
+            Object contentType = header.getValue();
+            Object charSetEnc = null;
+            
+            for (int i = 0; i < headers.length; i++) {
+                NameValuePair charsetEnc = headers[i].getParameterByName(
+                        HTTPConstants.CHAR_SET_ENCODING);
+                if (charsetEnc != null) {
+                	charSetEnc = charsetEnc.getValue();    
+                }
+            }
+            
             if (inMessageContext != null) {
                 inMessageContext
-                        .setProperty(Constants.Configuration.CONTENT_TYPE, header.getValue());
-
-
-                for (int i = 0; i < headers.length; i++) {
-                    NameValuePair charsetEnc = headers[i].getParameterByName(
-                            HTTPConstants.CHAR_SET_ENCODING);
-                    if (charsetEnc != null) {
-                        inMessageContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
-                                                     charsetEnc.getValue());    // change to the value, which is text/xml or application/xml+soap
-                    }
-                }
+                        .setProperty(Constants.Configuration.CONTENT_TYPE, contentType);
+                inMessageContext
+                	.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
+            } else {
+            	
+            	//Transport details will be stored in a HashMap so that anybody interested can retriece them
+            	HashMap transportInfoMap = new HashMap ();
+            	transportInfoMap.put(Constants.Configuration.CONTENT_TYPE, contentType);
+            	transportInfoMap.put(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
+            	
+            	//the HashMap is stored in the outgoing message.
+            	msgContext.setProperty(Constants.Configuration.TRANSPORT_INFO_MAP, transportInfoMap);
             }
         }
 

Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java?view=diff&rev=525477&r1=525476&r2=525477
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java Wed Apr  4 02:36:53 2007
@@ -687,7 +687,8 @@
         private HttpServletResponse response;
         private CountDownLatch responseReadySignal = new CountDownLatch(1);
         RequestResponseTransportStatus status = RequestResponseTransportStatus.INITIAL;
-
+        AxisFault faultToBeThrownOut = null;
+        
         ServletRequestResponseTransport(HttpServletResponse response) {
             this.response = response;
         }
@@ -710,10 +711,13 @@
         }
 
         public void awaitResponse()
-                throws InterruptedException {
+                throws InterruptedException,AxisFault {
             log.debug("Blocking servlet thread -- awaiting response");
             status = RequestResponseTransportStatus.WAITING;
             responseReadySignal.await();
+            
+            if (faultToBeThrownOut!=null)
+            	throw faultToBeThrownOut;
         }
 
         public void signalResponseReady() {
@@ -726,6 +730,11 @@
             return status;
         }
 
+		public void signalFaultReady(AxisFault fault) {
+			faultToBeThrownOut = fault;
+			signalResponseReady();
+		}
+		
     }
 
     /**

Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java?view=diff&rev=525477&r1=525476&r2=525477
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java Wed Apr  4 02:36:53 2007
@@ -324,15 +324,19 @@
 
         private CountDownLatch responseReadySignal = new CountDownLatch(1);
         RequestResponseTransportStatus status = RequestResponseTransportStatus.INITIAL;
-
+        AxisFault faultToBeThrownOut = null;
+        
         public void acknowledgeMessage(MessageContext msgContext) throws AxisFault {
             //TODO: Once the core HTTP API allows us to return an ack before unwinding, then the should be fixed
             signalResponseReady();
         }
 
-        public void awaitResponse() throws InterruptedException {
+        public void awaitResponse() throws InterruptedException,AxisFault {
             status = RequestResponseTransportStatus.WAITING;
             responseReadySignal.await();
+            
+            if (faultToBeThrownOut!=null)
+            	throw faultToBeThrownOut;
         }
 
         public void signalResponseReady() {
@@ -344,5 +348,10 @@
             return status;
         }
 
+		public void signalFaultReady(AxisFault fault) {
+			faultToBeThrownOut = fault;
+			signalResponseReady();
+		}
+        
     }
 }



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