ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kei...@apache.org
Subject svn commit: r586395 - in /webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2: description/ dispatchers/ transport/http/util/
Date Fri, 19 Oct 2007 12:11:30 GMT
Author: keithc
Date: Fri Oct 19 05:11:29 2007
New Revision: 586395

URL: http://svn.apache.org/viewvc?rev=586395&view=rev
Log:
Improving REST support


Modified:
    webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
    webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
    webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/dispatchers/HTTPLocationBasedDispatcher.java
    webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java

Modified: webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?rev=586395&r1=586394&r2=586395&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
(original)
+++ webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
Fri Oct 19 05:11:29 2007
@@ -533,8 +533,13 @@
 
             httpLocation =
                     (String) axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION);
+            String httpMethod =
+                    (String) axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_METHOD);
+            if (httpMethod == null || "".equals(httpMethod)) {
+                httpMethod = HTTPConstants.HEADER_POST;
+            }
             if (httpLocation != null) {
-                httpLocationMap.put(RESTUtil.getConstantFromHTTPLocation(httpLocation),
+                httpLocationMap.put(RESTUtil.getConstantFromHTTPLocation(httpLocation, httpMethod),
                                     axisBindingOperation.getAxisOperation());
             }
 

Modified: webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java?rev=586395&r1=586394&r2=586395&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
(original)
+++ webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
Fri Oct 19 05:11:29 2007
@@ -23,6 +23,7 @@
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.namespace.Constants;
+import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.transport.http.util.RESTUtil;
 import org.apache.axis2.wsdl.HTTPHeaderMessage;
 import org.apache.axis2.wsdl.SOAPHeaderMessage;
@@ -60,6 +61,7 @@
 import org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions;
 import org.apache.woden.wsdl20.extensions.http.HTTPHeader;
 import org.apache.woden.wsdl20.extensions.http.HTTPLocation;
+import org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions;
 import org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultExtensions;
 import org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultReferenceExtensions;
 import org.apache.woden.wsdl20.extensions.soap.SOAPBindingMessageReferenceExtensions;
@@ -67,7 +69,6 @@
 import org.apache.woden.wsdl20.extensions.soap.SOAPEndpointExtensions;
 import org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlock;
 import org.apache.woden.wsdl20.extensions.soap.SOAPModule;
-import org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions;
 import org.apache.woden.wsdl20.xml.DescriptionElement;
 import org.apache.woden.wsdl20.xml.DocumentableElement;
 import org.apache.woden.wsdl20.xml.DocumentationElement;
@@ -621,7 +622,7 @@
                 String httpLocationTemplete = httpLocation.getOriginalLocation();
                 axisBindingOperation
                         .setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, httpLocationTemplete);
-                httpLocationString = RESTUtil.getConstantFromHTTPLocation(httpLocationTemplete);
+                httpLocationString = RESTUtil.getConstantFromHTTPLocation(httpLocationTemplete,
HTTPConstants.HEADER_POST);
 
             }
 
@@ -730,8 +731,9 @@
             throw new AxisFault("HTTP Binding Extention not found");
         }
 
+        String httpMethodDefault = httpBindingExtensions.getHttpMethodDefault();
         axisBinding.setProperty(WSDL2Constants.ATTR_WHTTP_METHOD,
-                                httpBindingExtensions.getHttpMethodDefault());
+                                httpMethodDefault);
         axisBinding.setProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
                                 httpBindingExtensions.getHttpQueryParameterSeparatorDefault());
         axisBinding.setProperty(WSDL2Constants.ATTR_WHTTP_CONTENT_ENCODING,
@@ -800,6 +802,23 @@
                                              httpBindingOperationExtensions.getHttpFaultSerialization());
             axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION,
                                              httpBindingOperationExtensions.getHttpInputSerialization());
+            String httpMethod = httpBindingOperationExtensions.
+                    getHttpMethod();
+            if (httpMethod == null) {
+                if (httpMethodDefault != null) {
+                    httpMethod = httpMethodDefault;
+                } else {
+                    Boolean safeParameter =
+                            (Boolean) axisOperation.getParameterValue(WSDL2Constants.ATTR_WSDLX_SAFE);
+                    if (safeParameter != null && safeParameter.booleanValue()){
+                        httpMethod = HTTPConstants.HEADER_GET;
+                    } else {
+                        httpMethod = HTTPConstants.HEADER_POST;
+                    }
+                }
+            }
+            axisBindingOperation
+                    .setProperty(WSDL2Constants.ATTR_WHTTP_METHOD, httpMethod);
             HTTPLocation httpLocation = httpBindingOperationExtensions.getHttpLocation();
 
             // If httpLocation is not null we should extract a constant part from it and
add its value and the
@@ -810,7 +829,7 @@
                 String httpLocationTemplete = httpLocation.getOriginalLocation();
                 axisBindingOperation
                         .setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, httpLocationTemplete);
-                httpLocationString = RESTUtil.getConstantFromHTTPLocation(httpLocationTemplete);
+                httpLocationString = RESTUtil.getConstantFromHTTPLocation(httpLocationTemplete,
httpMethod);
 
             }
 
@@ -819,9 +838,6 @@
             axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED,
                                              httpBindingOperationExtensions.
                                                      isHttpLocationIgnoreUncited());
-            axisBindingOperation
-                    .setProperty(WSDL2Constants.ATTR_WHTTP_METHOD, httpBindingOperationExtensions.
-                            getHttpMethod());
             axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION,
                                              httpBindingOperationExtensions.getHttpOutputSerialization());
             axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,

Modified: webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/dispatchers/HTTPLocationBasedDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/dispatchers/HTTPLocationBasedDispatcher.java?rev=586395&r1=586394&r2=586395&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/dispatchers/HTTPLocationBasedDispatcher.java
(original)
+++ webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/dispatchers/HTTPLocationBasedDispatcher.java
Fri Oct 19 05:11:29 2007
@@ -21,13 +21,14 @@
 package org.apache.axis2.dispatchers;
 
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.engine.AbstractDispatcher;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisEndpoint;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.HandlerDescription;
 import org.apache.axis2.description.WSDL2Constants;
+import org.apache.axis2.engine.AbstractDispatcher;
+import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -55,8 +56,10 @@
             String uri = messageContext.getTo().getAddress();
             String httpLocation = parseRequestURL(uri, messageContext
                     .getConfigurationContext().getServiceContextPath());
+            String httpMethod = (String) messageContext.getProperty(HTTPConstants.HTTP_METHOD);
 
             if (httpLocation != null) {
+                httpLocation = httpMethod + httpLocation;
                 AxisEndpoint axisEndpoint = (AxisEndpoint) messageContext
                         .getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
                 // Here we check whether the request was dispatched to the correct endpoint.
If it

Modified: webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java?rev=586395&r1=586394&r2=586395&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java
(original)
+++ webservices/axis2/branches/java/1_3_post_mods/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java
Fri Oct 19 05:11:29 2007
@@ -155,7 +155,7 @@
         }
     }
 
-    public static String getConstantFromHTTPLocation(String httpLocation) {
+    public static String getConstantFromHTTPLocation(String httpLocation, String httpMethod)
{
         if (httpLocation.charAt(0) != '?') {
             httpLocation = "/" + httpLocation;
         }
@@ -163,7 +163,7 @@
         if (index > -1) {
             httpLocation = httpLocation.substring(0, index);
         }
-        return httpLocation;
+        return httpMethod + httpLocation;
     }
 
 }



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


Mime
View raw message