Author: indika
Date: Thu May 28 03:22:58 2009
New Revision: 37094
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=37094

Log:
Fix for a rest call issue, when do a rest call implicitly i.e without an 
endpoint or with an endpoint but without a ‘format’

Modified:
   
branches/synapse/1.3-wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java

Modified: 
branches/synapse/1.3-wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.3-wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java?rev=37094&r1=37093&r2=37094&view=diff
==============================================================================
--- 
branches/synapse/1.3-wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
    (original)
+++ 
branches/synapse/1.3-wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
    Thu May 28 03:22:58 2009
@@ -23,6 +23,7 @@
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.OperationClient;
@@ -169,7 +170,9 @@
                 }
 
             } else if 
(SynapseConstants.FORMAT_REST.equals(endpoint.getFormat())) {
-                axisOutMsgCtx.setDoingREST(true); 
+                axisOutMsgCtx.setDoingREST(true);
+            } else {
+                processHttpGetMethod(originalInMsgCtx, axisOutMsgCtx);
             }
 
             if (endpoint.isUseMTOM()) {
@@ -210,6 +213,8 @@
             if (endpoint.isUseSeparateListener()) {
                 axisOutMsgCtx.getOptions().setUseSeparateListener(true);
             }
+        } else {
+            processHttpGetMethod(originalInMsgCtx, axisOutMsgCtx);
         }
 
         if (wsAddressingEnabled) {
@@ -370,4 +375,17 @@
              current = current.getParent();
         }
     }
+
+    private static void processHttpGetMethod(MessageContext originalInMsgCtx,
+                                             MessageContext axisOutMsgCtx) {
+
+        String httpMethod = (String) originalInMsgCtx.getProperty(
+                Constants.Configuration.HTTP_METHOD);
+        if (Constants.Configuration.HTTP_METHOD_GET.equals(httpMethod)) {
+            axisOutMsgCtx.setProperty(
+                    org.apache.axis2.Constants.Configuration.MESSAGE_TYPE,
+                    HTTPConstants.MEDIA_TYPE_X_WWW_FORM);
+        }
+    }
+
 }

_______________________________________________
Esb-java-dev mailing list
[email protected]
https://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev

Reply via email to