axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kei...@apache.org
Subject svn commit: r513680 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: builder/XFormURLEncodedBuilder.java transport/TransportUtils.java transport/http/AbstractHTTPSender.java
Date Fri, 02 Mar 2007 09:50:24 GMT
Author: keithc
Date: Fri Mar  2 01:50:23 2007
New Revision: 513680

URL: http://svn.apache.org/viewvc?view=rev&rev=513680
Log:
Fixing client side issues in handling REST respnses
Fixing issues in XFormURLEncodedBuilder

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/XFormURLEncodedBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/XFormURLEncodedBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/XFormURLEncodedBuilder.java?view=diff&rev=513680&r1=513679&r2=513680
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/XFormURLEncodedBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/XFormURLEncodedBuilder.java
Fri Mar  2 01:50:23 2007
@@ -70,23 +70,27 @@
         if (endpointReference == null) {
             throw new AxisFault("Cannot create DocumentElement without destination EPR");
         }
-        String address = messageContext.getTo().getAddress();
-        String query = "";
+
+        String requestURL = endpointReference.getAddress();
+        try {
+            requestURL = extractParametersUsingHttpLocation(templatedPath, parameterMap,
+                                               requestURL,
+                                               queryParameterSeparator);
+        } catch (UnsupportedEncodingException e) {
+            throw new AxisFault(e);
+        }
+
+        String query = requestURL;
         int index;
-        if ((index = address.indexOf("?")) > 0) {
-            query = address.substring(index + 1);
+        if ((index = requestURL.indexOf("?")) > 0) {
+            query = requestURL.substring(index + 1);
         }
+
         extractParametersFromRequest(parameterMap, query, queryParameterSeparator,
                                      (String) messageContext.getProperty(
                                              Constants.Configuration.CHARACTER_SET_ENCODING),
                                      inputStream);
-        try {
-            extractParametersUsingHttpLocation(templatedPath, parameterMap,
-                                               endpointReference.getAddress(),
-                                               queryParameterSeparator);
-        } catch (UnsupportedEncodingException e) {
-            throw new AxisFault(e);
-        }
+
 
 
         return BuilderUtil.buildsoapMessage(messageContext, parameterMap,
@@ -114,8 +118,11 @@
             String parts[] = queryString.split(queryParamSeparator);
             for (int i = 0; i < parts.length; i++) {
                 int separator = parts[i].indexOf("=");
-                parameterMap
-                        .put(parts[i].substring(0, separator), parts[i].substring(separator
+ 1));
+                if (separator > 0) {
+                    parameterMap
+                            .put(parts[i].substring(0, separator),
+                                 parts[i].substring(separator + 1));
+                }
             }
 
         }
@@ -166,7 +173,7 @@
      * @param templatedPath
      * @param parameterMap
      */
-    protected void extractParametersUsingHttpLocation(String templatedPath,
+    protected String extractParametersUsingHttpLocation(String templatedPath,
                                                       MultipleEntryHashMap parameterMap,
                                                       String requestURL,
                                                       String queryParameterSeparator)
@@ -220,7 +227,7 @@
                                                   requestURIBuffer.substring(
                                                           endIndexOfConstant));
                             }
-                            startIndex = requestURIBuffer.length();
+                            return "";
                         } else {
 
                             constantPart =
@@ -233,7 +240,10 @@
                                               requestURIBuffer.substring(
                                                       endIndexOfConstant, indexOfNextConstant));
 
-                            startIndex = requestURIBuffer.length();
+                            if (requestURIBuffer.length() > indexOfNextConstant + 1) {
+                                return requestURIBuffer.substring(indexOfNextConstant + 1);
+                            }
+                            return "";
                         }
                     } else {
 
@@ -253,8 +263,9 @@
                 }
 
             }
-
         }
+
+        return requestURL;
     }
 
     private void addParameterToMap(MultipleEntryHashMap parameterMap, String paramName,

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java?view=diff&rev=513680&r1=513679&r2=513680
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
Fri Mar  2 01:50:23 2007
@@ -145,7 +145,7 @@
 			SOAPFactory soapFactory = new SOAP11Factory();
 			envelope = soapFactory.getDefaultEnvelope();
 			envelope.getBody().addChild(documentElement);
-		}
+		}                                                                                     
                                
         return envelope;
     }
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java?view=diff&rev=513680&r1=513679&r2=513680
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
Fri Mar  2 01:50:23 2007
@@ -21,6 +21,7 @@
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.description.Parameter;
@@ -204,24 +205,26 @@
      * @param msgContext
      */
     protected void obtainHTTPHeaderInformation(HttpMethodBase method,
-                                               MessageContext msgContext) {
+                                               MessageContext msgContext) throws AxisFault
{
            Map transportHeaders =  new CommonsTransportHeaders(method.getResponseHeaders());
         msgContext.setProperty(MessageContext.TRANSPORT_HEADERS,transportHeaders);
         Header header =method.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
 
         if (header != null) {
             HeaderElement[] headers = header.getElements();
-            OperationContext opContext = msgContext.getOperationContext();
+            MessageContext inMessageContext = msgContext.getOperationContext().getMessageContext(
+                    WSDLConstants.MESSAGE_LABEL_IN_VALUE);
             
-            if (opContext != null) {
-                opContext.setProperty(Constants.Configuration.CONTENT_TYPE,
-                        header.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) {
-                        opContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
+                        inMessageContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
                                 charsetEnc.getValue());    // change to the value, which
is text/xml or application/xml+soap
                 }
             }



---------------------------------------------------------------------
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