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 ke...@apache.org on 2007/03/01 14:03:13 UTC

svn commit: r513299 [2/2] - in /webservices/axis2/trunk/java/modules/kernel: conf/ src/org/apache/axis2/builder/ src/org/apache/axis2/deployment/ src/org/apache/axis2/description/ src/org/apache/axis2/transport/ src/org/apache/axis2/transport/http/ src...

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java?view=diff&rev=513299&r1=513298&r2=513299
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java Thu Mar  1 05:03:10 2007
@@ -15,176 +15,95 @@
  */
 package org.apache.axis2.transport.http.util;
 
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-import java.util.zip.GZIPInputStream;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.impl.OMNodeEx;
-import org.apache.axiom.om.impl.builder.StAXBuilder;
-import org.apache.axiom.soap.SOAPBody;
 import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.builder.BuilderUtil;
-import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisBindingOperation;
 import org.apache.axis2.description.AxisEndpoint;
-import org.apache.axis2.description.AxisMessage;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.WSDL2Constants;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.engine.HTTPLocationBasedDispatcher;
+import org.apache.axis2.engine.Handler;
 import org.apache.axis2.engine.RequestURIBasedDispatcher;
 import org.apache.axis2.engine.RequestURIOperationDispatcher;
-import org.apache.axis2.engine.SOAPActionBasedDispatcher;
+import org.apache.axis2.transport.TransportUtils;
 import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.axis2.util.SchemaUtil;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.axis2.transport.http.HTTPTransportUtils;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 
 /**
  *
  */
 public class RESTUtil {
-    protected ConfigurationContext configurationContext;
 
-    public RESTUtil(ConfigurationContext configurationContext) {
-        this.configurationContext = configurationContext;
-    }
-
-    public boolean processPostRequest(MessageContext msgContext,
-                                      HttpServletRequest request,
-                                      HttpServletResponse response) throws AxisFault {
+    public static Handler.InvocationResponse processXMLRequest(MessageContext msgContext,
+                                                               InputStream in,
+                                                               OutputStream out, String contentType)
+            throws AxisFault {
         try {
-            // 1. if the content type is text/xml or multipart/related, all the information
-            // SHOULD be in HTTP body. So consruct a SOAP Envelope, out of the
-            // the input stream extracted from the HTTP request,
-            // set that to msgCtxt and return. Do we need to verify this
-            // with the schema here ???
-            String contentType = request.getContentType();
-            SOAPEnvelope soapEnvelope;
-            if ("".equals(contentType) || contentType == null) {
-                throw new AxisFault("ContentType should be given to proceed," +
-                        " according to WSDL 2.0 HTTP binding rules");
-            } else if (contentType.indexOf(HTTPConstants.MEDIA_TYPE_TEXT_XML) > -1 ||
-                    contentType.indexOf(HTTPConstants.MEDIA_TYPE_MULTIPART_RELATED) > -1  ||
-                    contentType.indexOf(HTTPConstants.MEDIA_TYPE_APPLICATION_XML) > -1) {
-                soapEnvelope = handleNonURLEncodedContentTypes(msgContext, request,
-                        OMAbstractFactory.getSOAP12Factory());
-            } else if (contentType.indexOf(HTTPConstants.MEDIA_TYPE_X_WWW_FORM) > -1 ||
-                    contentType.indexOf(HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA) > -1) {
-                // 2. Else, Dispatch and find out the operation and the service.
-                // Dispatching can only be done using the RequestURI, as others can not be run in the REST case
-                dispatchAndVerify(msgContext);
-
-                // 3. extract the schema from the operation.
-                AxisOperation axisOperation = msgContext.getAxisOperation();
-                // get XML schema element here from the AxisOperation
-                XmlSchemaElement xmlSchemaElement =
-                        axisOperation.
-                                getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getSchemaElement();
-
-                soapEnvelope = SchemaUtil.handleMediaTypeURLEncoded(msgContext,
-                        request,
-                        xmlSchemaElement,
-                        OMAbstractFactory.getSOAP12Factory());
-            } else {
-                throw new AxisFault(
-                        "Content type should be one of /n " + HTTPConstants.MEDIA_TYPE_TEXT_XML +
-                                "/n " + HTTPConstants.MEDIA_TYPE_X_WWW_FORM +
-                        "/n " + HTTPConstants.MEDIA_TYPE_APPLICATION_XML +
-                        "/n " + HTTPConstants.MEDIA_TYPE_MULTIPART_RELATED);
-            }
-
-
+            msgContext.setDoingREST(true);
+            String charSetEncoding = BuilderUtil.getCharSetEncoding(contentType);
+            msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEncoding);
+            dispatchAndVerify(msgContext);
+            in = HTTPTransportUtils.handleGZip(msgContext, in);
+            SOAPEnvelope soapEnvelope = TransportUtils
+                    .createSOAPMessage(msgContext, in, contentType);
             msgContext.setEnvelope(soapEnvelope);
-            msgContext.setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD,
-                                   org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD_POST);
             msgContext.setProperty(Constants.Configuration.CONTENT_TYPE,
                                    contentType);
-            msgContext.setDoingREST(true);
-            msgContext.setProperty(MessageContext.TRANSPORT_OUT, response.getOutputStream());
 
-            invokeAxisEngine(msgContext);
+            msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
+            msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE,
+                                   HTTPConstants.MEDIA_TYPE_APPLICATION_XML);
+            return invokeAxisEngine(msgContext);
 
         } catch (AxisFault axisFault) {
             throw axisFault;
-        } catch (IOException ioException) {
-            throw new AxisFault(ioException);
+        } catch (XMLStreamException e) {
+            throw new AxisFault(e);
+        } catch (IOException e) {
+            throw new AxisFault(e);
         }
-        return true;
     }
 
-    public boolean processGetRequest(MessageContext msgContext,
-                                     HttpServletRequest request,
-                                     HttpServletResponse response) throws AxisFault {
+    public static Handler.InvocationResponse processURLRequest(MessageContext msgContext,
+                                                               OutputStream out, String contentType)
+            throws AxisFault {
         // here, only the parameters in the URI are supported. Others will be discarded.
         try {
 
-            // when using the wsdl2 soap response MEP it can contain soap action. We better look for it here,
-            // if its there put it into msgContext so that we can use it later for dispatching purposes.
-
-            String contentType = request.getContentType();
-
-            if (contentType != null) {
-
-                //Check for action header and set it in as soapAction in MessageContext
-                int index = contentType.indexOf("action");
-                if (index > -1) {
-                    String transientString = contentType.substring(index, contentType.length());
-                    int equal = transientString.indexOf("=");
-                    int firstSemiColon = transientString.indexOf(";");
-                    String soapAction; // This will contain "" in the string
-                    if (firstSemiColon > -1) {
-                        soapAction = transientString.substring(equal + 1, firstSemiColon);
-                    } else {
-                        soapAction = transientString.substring(equal + 1, transientString.length());
-                    }
-                    if ((soapAction != null) && soapAction.startsWith("\"")
-                            && soapAction.endsWith("\"")) {
-                        soapAction = soapAction
-                                .substring(1, soapAction.length() - 1);
-                    }
-                    msgContext.setSoapAction(soapAction);
-
-                }
+            if (contentType == null || "".equals(contentType)) {
+                contentType = HTTPConstants.MEDIA_TYPE_X_WWW_FORM;
             }
 
             // set the required properties so that even if there is an error during the dispatch
             // phase the response message will be passed to the client well. 
             msgContext.setDoingREST(true);
-            msgContext.setProperty(MessageContext.TRANSPORT_OUT, response.getOutputStream());
-
+            msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
+            String charSetEncoding = BuilderUtil.getCharSetEncoding(contentType);
+            msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEncoding);
             // 1. First dispatchAndVerify and find out the service and the operation.
             dispatchAndVerify(msgContext);
-
-            // 2. extract the schema from the operation and construct the SOAP message out of it.
-            // 3. extract the schema from the operation.
-            AxisOperation axisOperation = msgContext.getAxisOperation();
-
-            XmlSchemaElement xmlSchemaElement = null;
-            if (axisOperation != null) {
-                AxisMessage axisMessage =
-                        axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-                xmlSchemaElement = axisMessage.getSchemaElement();
+            SOAPEnvelope soapEnvelope;
+            try {
+                soapEnvelope = TransportUtils
+                        .createSOAPMessage(msgContext, null, contentType);
+            } catch (XMLStreamException e) {
+                throw new AxisFault(e);
             }
 
-            SOAPEnvelope soapEnvelope = SchemaUtil.handleMediaTypeURLEncoded(msgContext,
-                    request,
-                    xmlSchemaElement,
-                    OMAbstractFactory.getSOAP12Factory());
             msgContext.setEnvelope(soapEnvelope);
-
-            invokeAxisEngine(msgContext);
+            msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE,
+                                   HTTPConstants.MEDIA_TYPE_APPLICATION_XML);
+            return invokeAxisEngine(msgContext);
 
         } catch (AxisFault axisFault) {
             throw axisFault;
@@ -192,16 +111,16 @@
         catch (IOException e) {
             throw new AxisFault(e);
         }
-        return true;
     }
 
-    private void invokeAxisEngine(MessageContext messageContext) throws AxisFault {
-        AxisEngine axisEngine = new AxisEngine(configurationContext);
-        axisEngine.receive(messageContext);
+    private static Handler.InvocationResponse invokeAxisEngine(MessageContext messageContext)
+            throws AxisFault {
+        AxisEngine axisEngine = new AxisEngine(messageContext.getConfigurationContext());
+        return axisEngine.receive(messageContext);
 
     }
 
-    private void dispatchAndVerify(MessageContext msgContext) throws AxisFault {
+    private static void dispatchAndVerify(MessageContext msgContext) throws AxisFault {
         RequestURIBasedDispatcher requestDispatcher = new RequestURIBasedDispatcher();
         requestDispatcher.invoke(msgContext);
         AxisService axisService = msgContext.getAxisService();
@@ -216,11 +135,6 @@
                 httpLocationBasedDispatcher.invoke(msgContext);
             }
 
-            if (msgContext.getAxisOperation() == null) {
-                SOAPActionBasedDispatcher soapActionBasedDispatcher =
-                        new SOAPActionBasedDispatcher();
-                soapActionBasedDispatcher.invoke(msgContext);
-            }
             AxisOperation axisOperation;
             if ((axisOperation = msgContext.getAxisOperation()) != null) {
                 AxisEndpoint axisEndpoint =
@@ -234,83 +148,15 @@
             }
 
             // check for the dispatching result
-            if (msgContext.getAxisOperation() == null) {
-                throw new AxisFault("I can not find a service for this request to be serviced." +
-                        " Check the WSDL and the request URI");
-            }
-        } else {
-            throw new AxisFault("I can not find a service for this request to be serviced." +
-                    " Check the WSDL and the request URI");
-        }
-    }
-
-    private SOAPEnvelope handleNonURLEncodedContentTypes(MessageContext msgCtxt,
-                                                         HttpServletRequest request,
-                                                         SOAPFactory soapFactory) throws AxisFault {
-        try {
-
-            SOAPEnvelope soapEnvelope = soapFactory.getDefaultEnvelope();
-            SOAPBody body = soapEnvelope.getBody();
-
-            InputStream inputStream = new BufferedInputStream(request.getInputStream());
-            Map headers = (Map) msgCtxt.getProperty(MessageContext.TRANSPORT_HEADERS);
-            if (headers != null) {
-                if (HTTPConstants.COMPRESSION_GZIP.equals(headers.get(HTTPConstants.HEADER_CONTENT_ENCODING)) ||
-                        HTTPConstants.COMPRESSION_GZIP.equals(headers.get(HTTPConstants.HEADER_CONTENT_ENCODING_LOWERCASE))) {
-                    inputStream = new GZIPInputStream(inputStream);
-                }
-                }
-            String contentType = request.getContentType();
-
-            // irrespective of the schema, if the media type is text/xml, all the information
-            // should be in the body.
-            // I'm assuming here that the user is sending this data according to the schema.
-            if (checkContentType(
-                    org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_MULTIPART_RELATED,
-                    contentType)) {
-                body.addChild(BuilderUtil.getAttachmentsBuilder(msgCtxt,
-                                                            inputStream,
-                                                            contentType,
-                                                            false).getDocumentElement());
-            } else if (checkContentType(
-                    org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_TEXT_XML,
-                    contentType) ||
-                    checkContentType(
-                            org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_APPLICATION_XML,
-                            contentType)) {
-
-                String charSetEnc = BuilderUtil.getCharSetEncoding(contentType);
-                if (charSetEnc == null) {
-                    // If charset is not specified
-                    charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING;
-                }
-                // Setting the value in msgCtx
-                msgCtxt.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
-
-                // Create documentElement only if the content length is greator than 0
-                if (request.getContentLength() != 0) {
-                    StAXBuilder builder = BuilderUtil.getPOXBuilder(inputStream, charSetEnc);
-                    OMNodeEx documentElement = (OMNodeEx) builder.getDocumentElement();
-                    documentElement.setParent(null);
-                    body.addChild(documentElement);
-                }
-            }
-
-            return soapEnvelope;
-
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            throw new AxisFault("Error in creating a SOAPEnvelope from the REST request");
-        }
-
-    }
-
-    private boolean checkContentType(String contentType, String contentTypeStringFromRequest) {
-        if (contentTypeStringFromRequest == null) {
-            return false;
-        }
-        return contentTypeStringFromRequest.indexOf(contentType) > -1;
+//            if (msgContext.getAxisOperation() == null) {
+//                throw new AxisFault("I can not find a service for this request to be serviced." +
+//                        " Check the WSDL and the request URI");
+//            }
+        }
+//        else {
+//            throw new AxisFault("I can not find a service for this request to be serviced." +
+//                    " Check the WSDL and the request URI");
+//        }
     }
 
     public static String getConstantFromHTTPLocation(String httpLocation) {

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/URIEncoderDecoder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/URIEncoderDecoder.java?view=auto&rev=513299
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/URIEncoderDecoder.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/URIEncoderDecoder.java Thu Mar  1 05:03:10 2007
@@ -0,0 +1,214 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.transport.http.util;
+
+import java.net.URISyntaxException;
+import java.io.UnsupportedEncodingException;
+import java.io.ByteArrayOutputStream;
+
+public class URIEncoderDecoder {
+
+    static final String digits = "0123456789ABCDEF"; //$NON-NLS-1$
+
+    static final String encoding = "UTF8"; //$NON-NLS-1$
+
+    /**
+     * Validate a string by checking if it contains any characters other than:
+     *
+     * 1. letters ('a'..'z', 'A'..'Z') 2. numbers ('0'..'9') 3. characters in
+     * the legalset parameter 4. others (Unicode characters that are not in
+     * US-ASCII set, and are not ISO Control or are not ISO Space characters)
+     * <p>
+     * called from URI.Helper.parseURI() to validate each component
+     * <p>
+     *
+     * @param s
+     *            java.lang.String the string to be validated
+     * @param legal
+     *            java.lang.String the characters allowed in the String s
+     *
+     */
+    static void validate(String s, String legal) throws URISyntaxException {
+        for (int i = 0; i < s.length();) {
+            char ch = s.charAt(i);
+            if (ch == '%') {
+                do {
+                    if (i + 2 >= s.length()) {
+                        throw new URISyntaxException(s, "Incomplete % sequence");
+                    }
+                    int d1 = Character.digit(s.charAt(i + 1), 16);
+                    int d2 = Character.digit(s.charAt(i + 2), 16);
+                    if (d1 == -1 || d2 == -1) {
+                        throw new URISyntaxException(s, "Invalid % sequence " + s.substring(i, i + 3)
+                                , i);
+                    }
+
+                    i += 3;
+                } while (i < s.length() && s.charAt(i) == '%');
+
+                continue;
+            }
+            if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')
+                    || (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1 || (ch > 127
+                    && !Character.isSpaceChar(ch) && !Character
+                    .isISOControl(ch)))) {
+                throw new URISyntaxException(s, "Illegal character", i);
+            }
+            i++;
+        }
+    }
+
+    static void validateSimple(String s, String legal)
+            throws URISyntaxException {
+        for (int i = 0; i < s.length();) {
+            char ch = s.charAt(i);
+            if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')
+                    || (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1)) {
+                throw new URISyntaxException(s, "Illegal character", i); //$NON-NLS-1$
+            }
+            i++;
+        }
+    }
+
+    /**
+     * All characters except letters ('a'..'z', 'A'..'Z') and numbers ('0'..'9')
+     * and legal characters are converted into their hexidecimal value prepended
+     * by '%'.
+     * <p>
+     * For example: '#' -> %23
+     * <p>
+     * Other characters, which are Unicode chars that are not US-ASCII, and are
+     * not ISO Control or are not ISO Space chars, are preserved.
+     * <p>
+     * Called from URI.quoteComponent() (for multiple argument constructors)
+     * <p>
+     *
+     * @param s
+     *            java.lang.String the string to be converted
+     * @param legal
+     *            java.lang.String the characters allowed to be preserved in the
+     *            string s
+     * @return java.lang.String the converted string
+     */
+    public static String quoteIllegal(String s, String legal)
+            throws UnsupportedEncodingException {
+        StringBuffer buf = new StringBuffer();
+        for (int i = 0; i < s.length(); i++) {
+            char ch = s.charAt(i);
+            if ((ch >= 'a' && ch <= 'z')
+                    || (ch >= 'A' && ch <= 'Z')
+                    || (ch >= '0' && ch <= '9')
+                    || legal.indexOf(ch) > -1
+                    || (ch > 127 && !Character.isSpaceChar(ch) && !Character
+                            .isISOControl(ch))) {
+                buf.append(ch);
+            } else {
+                byte[] bytes = new String(new char[] { ch }).getBytes(encoding);
+                for (int j = 0; j < bytes.length; j++) {
+                    buf.append('%');
+                    buf.append(digits.charAt((bytes[j] & 0xf0) >> 4));
+                    buf.append(digits.charAt(bytes[j] & 0xf));
+                }
+            }
+        }
+        return buf.toString();
+    }
+
+    /**
+     * Other characters, which are Unicode chars that are not US-ASCII, and are
+     * not ISO Control or are not ISO Space chars are not preserved. They are
+     * converted into their hexidecimal value prepended by '%'.
+     * <p>
+     * For example: Euro currency symbol -> "%E2%82%AC".
+     * <p>
+     * Called from URI.toASCIIString()
+     * <p>
+     *
+     * @param s
+     *            java.lang.String the string to be converted
+     * @return java.lang.String the converted string
+     */
+    static String encodeOthers(String s) throws UnsupportedEncodingException {
+        StringBuffer buf = new StringBuffer();
+        for (int i = 0; i < s.length(); i++) {
+            char ch = s.charAt(i);
+            if (ch <= 127) {
+                buf.append(ch);
+            } else {
+                byte[] bytes = new String(new char[] { ch }).getBytes(encoding);
+                for (int j = 0; j < bytes.length; j++) {
+                    buf.append('%');
+                    buf.append(digits.charAt((bytes[j] & 0xf0) >> 4));
+                    buf.append(digits.charAt(bytes[j] & 0xf));
+                }
+            }
+        }
+        return buf.toString();
+    }
+
+    /**
+     * Decodes the string argument which is assumed to be encoded in the
+     * <code>x-www-form-urlencoded</code> MIME content type using the UTF-8
+     * encoding scheme.
+     * <p>
+     * '%' and two following hex digit characters are converted to the
+     * equivalent byte value. All other characters are passed through
+     * unmodified.
+     *
+     * <p>
+     * e.g. "A%20B%20C %24%25" -> "A B C $%"
+     * <p>
+     * Called from URI.getXYZ() methods
+     * <p>
+     *
+     * @param s
+     *            java.lang.String The encoded string.
+     * @return java.lang.String The decoded version.
+     */
+   public static String decode(String s) throws UnsupportedEncodingException {
+
+        StringBuffer result = new StringBuffer();
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        for (int i = 0; i < s.length();) {
+            char c = s.charAt(i);
+            if (c == '%') {
+                out.reset();
+                do {
+                    if (i + 2 >= s.length()) {
+                        throw new IllegalArgumentException("Incomplete % sequence at " + i);
+                    }
+                    int d1 = Character.digit(s.charAt(i + 1), 16);
+                    int d2 = Character.digit(s.charAt(i + 2), 16);
+                    if (d1 == -1 || d2 == -1) {
+                        throw new IllegalArgumentException("Invalid % sequence" +  s.substring(i, i + 3) + "at " +
+                                String.valueOf(i));
+                    }
+                    out.write((byte) ((d1 << 4) + d2));
+                    i += 3;
+                } while (i < s.length() && s.charAt(i) == '%');
+                result.append(out.toString(encoding));
+                continue;
+            }
+            result.append(c);
+            i++;
+        }
+        return result.toString();
+    }
+
+}
+
+

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java?view=diff&rev=513299&r1=513298&r2=513299
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java Thu Mar  1 05:03:10 2007
@@ -29,7 +29,6 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLEncoder;
-import java.util.ArrayList;
 import java.util.Iterator;
 
 
@@ -70,7 +69,9 @@
         for (int i = 0; i < localNames.length; i++) {
             String localName = localNames[i];
             try {
-                values[i] = URLEncoder.encode(getOMElementValue(localName, firstElement), "UTF-8");
+                values[i] = URIEncoderDecoder.quoteIllegal(
+                        getOMElementValue(localName, firstElement),
+                        WSDL2Constants.LEGAL_CHARACTERS_IN_URL);
             } catch (UnsupportedEncodingException e) {
                 throw new AxisFault("Unable to encode Query String");
             }
@@ -85,10 +86,10 @@
      * Appends Query parameters to the URL
      *
      * @param messageContext - The MessageContext of the request
-     * @param query          - Original query string
+     * @param url          - Original url string
      * @return String containing the appended query parameters
      */
-    private static String appendQueryParameters(MessageContext messageContext, String query) {
+    private static String appendQueryParameters(MessageContext messageContext, String url) {
 
         OMElement firstElement;
         String queryParameterSeparator = (String) messageContext
@@ -101,30 +102,32 @@
         }
 
         firstElement = messageContext.getEnvelope().getBody().getFirstElement();
-        ArrayList values = new ArrayList();
+        String params = "";
 
         if (firstElement != null) {
             Iterator iter = firstElement.getChildElements();
 
             while (iter.hasNext()) {
                 OMElement element = (OMElement) iter.next();
-                values.add(element.getLocalName() + "=" + element.getText());
+                params = params + element.getLocalName() + "=" + element.getText() +
+                        queryParameterSeparator;
             }
         }
 
-        if (values.size() > 0) {
+        if (!"".equals(params)) {
 
-            if (query.indexOf("?") == query.length() - 1) {
-                query = query + values.get(0);
+            int index = url.indexOf("?");
+            if (index == -1) {
+                url = url + "?" + params.substring(0,params.length()-1);
+            }
+            else if (index == url.length() - 1) {
+                url = url + params.substring(0,params.length()-1);
             } else {
-                query = query + "?" + values.get(0);
+                url = url + queryParameterSeparator + params.substring(0,params.length()-1);
             }
 
-            for (int i = 1; i < values.size(); i++) {
-                query = query + queryParameterSeparator + values.get(i);
-            }
         }
-        return query;
+        return url;
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/MultipleEntryHashMap.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/MultipleEntryHashMap.java?view=diff&rev=513299&r1=513298&r2=513299
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/MultipleEntryHashMap.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/MultipleEntryHashMap.java Thu Mar  1 05:03:10 2007
@@ -3,6 +3,7 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
  *
@@ -62,5 +63,10 @@
         }
 
         return value;
+    }
+
+    public Set keySet() {
+
+        return table.keySet();
     }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java?view=diff&rev=513299&r1=513298&r2=513299
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java Thu Mar  1 05:03:10 2007
@@ -96,385 +96,4 @@
             }
         }
     }
-
-    /**
-     * This method is designed for REST handling. Parameters of a REST request comes in the URL or in
-     * the body of the message (if it is POST). Since those parameters may not be in the proper order,
-     * we need to retrieve the schema of the operation and construct the message according to the
-     * parameters received as the REST request.
-     * This method will carry out that function and it is assumed that this method is called in that
-     * scenarios only.
-     *
-     * @param msgCtxt
-     * @param request
-     * @param xmlSchemaElement
-     * @param soapFactory
-     * @throws AxisFault
-     */
-
-    public static SOAPEnvelope handleMediaTypeURLEncoded(MessageContext msgCtxt,
-                                                         HttpServletRequest request,
-                                                         XmlSchemaElement xmlSchemaElement,
-                                                         SOAPFactory soapFactory) throws AxisFault {
-
-        SOAPEnvelope soapEnvelope = soapFactory.getDefaultEnvelope();
-        SOAPBody body = soapEnvelope.getBody();
-        String queryParameterSeparator = null;
-        AxisBindingOperation axisBindingOperation = (AxisBindingOperation)msgCtxt.getProperty(Constants.AXIS_BINDING_OPERATION);
-        if (axisBindingOperation != null) {
-            queryParameterSeparator = (String)axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR);
-        }
-        Map requestParameterMap = getParameterMap(request, queryParameterSeparator);
-
-        if (xmlSchemaElement == null) {
-            // if there is no schema its piece of cake !! add these to the soap body in any order you like.
-            // Note : if there are parameters in the path of the URL, there is no way this can add them
-            // to the message.
-            OMElement bodyFirstChild = soapFactory.createOMElement(msgCtxt.getAxisOperation().getName(), body);
-
-            // first add the parameters in the URL
-            if (requestParameterMap != null) {
-                Iterator requestParamMapIter = requestParameterMap.keySet().iterator();
-                while (requestParamMapIter.hasNext()) {
-                    String key = (String) requestParamMapIter.next();
-                    String value = (String) ((Object[]) requestParameterMap.get(key))[0];
-                    soapFactory.createOMElement(key, null, bodyFirstChild).setText(value);
-
-                }
-            }
-        } else {
-
-            // first get the target namespace from the schema and the wrapping element.
-            // create an OMElement out of those information. We are going to extract parameters from
-            // url, create OMElements and add them as children to this wrapping element.
-            String targetNamespace = xmlSchemaElement.getQName().getNamespaceURI();
-            QName bodyFirstChildQName;
-            if (targetNamespace != null && !"".equals(targetNamespace)) {
-                bodyFirstChildQName = new QName(targetNamespace, xmlSchemaElement.getName());
-            } else {
-                bodyFirstChildQName = new QName(xmlSchemaElement.getName());
-            }
-            OMElement bodyFirstChild = soapFactory.createOMElement(bodyFirstChildQName, body);
-
-                // Schema should adhere to the IRI style in this. So assume IRI style and dive in to
-                // schema
-            XmlSchemaType schemaType = xmlSchemaElement.getSchemaType();
-            if (schemaType instanceof XmlSchemaComplexType) {
-                XmlSchemaComplexType complexType = ((XmlSchemaComplexType) schemaType);
-                XmlSchemaParticle particle = complexType.getParticle();
-                if (particle instanceof XmlSchemaSequence) {
-                    XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) particle;
-                    Iterator iterator = xmlSchemaSequence.getItems().getIterator();
-
-                    // now we need to know some information from the binding operation.
-
-                    // Now we are going to extrac information from the binding operation. WSDL 2.0
-                    // http bindiing allows to define a query parameter separator. To capture it
-                    // create a variable wit the default as "&"
-
-                    MultipleEntryHashMap httpLocationParameterMap = new MultipleEntryHashMap();
-                    if (axisBindingOperation != null) {
-
-                        // get the http location property
-                        String httpLocation = (String) axisBindingOperation
-                                .getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION);
-
-                        // parameter names can be different from the element name in the schema, due
-                        // to http location. Let's filter the parameter names from it.
-                        httpLocationParameterMap = createHttpLocationParameterMap(httpLocation,
-                                                                                  queryParameterSeparator,
-                                                                                  request,
-                                                                                  requestParameterMap);
-
-                    }
-
-                    while (iterator.hasNext()) {
-                        XmlSchemaElement innerElement = (XmlSchemaElement) iterator.next();
-                        QName qName = innerElement.getQName();
-                        long minOccurs = innerElement.getMinOccurs();
-                        boolean nillable = innerElement.isNillable();
-                        while (minOccurs != 0) {
-                            String name =
-                                    qName != null ? qName.getLocalPart() : innerElement.getName();
-
-                            // check whether this has a mapping in httpLocationParameterMap.
-                            String value = (String) httpLocationParameterMap.get(name);
-                            OMNamespace ns = (qName == null ||
-                                            qName.getNamespaceURI() == null
-                                            || qName.getNamespaceURI().length() == 0) ?
-                                            null : soapFactory.createOMNamespace(
-                                            qName.getNamespaceURI(), null);
-                            if (value == null) {
-                                String[] parameterValuesArray =
-                                        (String[]) requestParameterMap.get(name);
-                                if (parameterValuesArray != null &&
-                                        !"".equals(parameterValuesArray[0]) &&
-                                        parameterValuesArray[0] != null) {
-                                    value = parameterValuesArray[0];
-
-                                    for (int i = 0 ; i < parameterValuesArray.length ; i++) {
-                                        soapFactory.createOMElement(name, ns,
-                                                bodyFirstChild).setText(parameterValuesArray[i]);
-                                    }
-                                }
-                            } else {
-                                 soapFactory.createOMElement(name, ns,
-                                                bodyFirstChild).setText(value);
-                            }
-
-                            if (value == null) {
-
-                                if (nillable) {
-
-                                    OMNamespace xsi = soapFactory.createOMNamespace(
-                                            Constants.URI_DEFAULT_SCHEMA_XSI,
-                                            Constants.NS_PREFIX_SCHEMA_XSI);
-                                    OMAttribute omAttribute =
-                                            soapFactory.createOMAttribute("nil", xsi, "true");
-                                    soapFactory.createOMElement(name, ns,
-                                                                bodyFirstChild)
-                                            .addAttribute(omAttribute);
-
-                                } else {
-                                    throw new AxisFault("Required element " + qName +
-                                            " defined in the schema can not be found in the request");
-                                }
-                            }
-                            minOccurs--;
-                        }
-                    }
-                }
-            }
-        }
-        return soapEnvelope;
-    }
-
-    /**
-     * WSDL 2.0 HTTP binding introduces the concept of http location. User can provide some thing like
-     * ?first={FirstName}, where FirstName is what is defined in the schema. In this case, when you
-     * want to get the parameter value from the request parameter map, you have to ask for "first" and
-     * not "FirstName".
-     * <p/>
-     * This method will create a map from the schema name to the name visible in the query string.
-     * Eg: FirstName ==> first
-     *
-     * @param httpLocation
-     * @param queryParameterSeparator
-     */
-    protected static MultipleEntryHashMap createHttpLocationParameterMap(String httpLocation,
-                                                                         String queryParameterSeparator,
-                                                                         HttpServletRequest request,
-                                                                         Map parameterMap)
-            throws AxisFault {
-
-        MultipleEntryHashMap httpLocationParameterMap = new MultipleEntryHashMap();
-
-        if (httpLocation != null) {
-
-            // let's handle query parameters and the path separately
-            String[] urlParts = httpLocation.split("\\?");
-            String templatedPath = urlParts[0];
-
-            if (urlParts.length > 1) {
-                String templatedQueryParams = urlParts[1];
-                // first extract parameters from the query part
-                extractParametersFromQueryPart(templatedQueryParams, queryParameterSeparator,
-                                               httpLocationParameterMap, parameterMap);
-            }
-
-            // now let's do the difficult part, extract parameters from the path element.
-            extractParametersFromPath(templatedPath, httpLocationParameterMap,
-                                      request.getRequestURI());
-        }
-        return httpLocationParameterMap;
-    }
-
-    protected static void extractParametersFromQueryPart(String templatedQueryParams,
-                                                         String queryParameterSeparator,
-                                                         MultipleEntryHashMap httpLocationParameterMap,
-                                                         Map parameterMap) {
-        // now let's tokenize the string with query parameter separator
-        String[] nameValuePairs = templatedQueryParams.split(queryParameterSeparator);
-        for (int i = 0; i < nameValuePairs.length; i++) {
-            StringBuffer buffer = new StringBuffer(nameValuePairs[i]);
-            // this name value pair will be either name=value or
-            // name={SchemaElementName}. The first case is handled above
-            // let's handle the second case
-            if (buffer.indexOf("{") > 0 && buffer.indexOf("}") > 0) {
-                String parameterName = buffer.substring(0, buffer.indexOf("="));
-                String schemaElementName =
-                        buffer.substring(buffer.indexOf("=") + 2, buffer.length() - 1);
-                String[] parameterValues = (String[]) parameterMap.get(parameterName);
-                String value;
-                if (parameterValues != null && (value =parameterValues[0]) != null) {
-                    httpLocationParameterMap.put(schemaElementName, value);
-                }
-            }
-
-        }
-    }
-
-    /**
-     * Here is what I will try to do here. I will first try to identify the location of the first
-     * template element in the request URI. I am trying to deduce the location of that location
-     * using the httpLocation element of the binding (it is passed in to this
-     * method).
-     * If there is a contant part in the httpLocation, then I will identify it. For this, I get
-     * the index of {, from httpLocation param, and whatever to the left of it is the contant part.
-     * Then I search for this constant part inside the url. This will give us the access to the first
-     * template parameter.
-     * To find the end of this parameter, we need to get the index of the next constant, from
-     * httpLocation attribute. Likewise we keep on discovering parameters.
-     * <p/>
-     * Assumptions :
-     * 1. User will always append the value of httpLocation to the address given in the
-     * endpoint.
-     * 2. I was talking about the constants in the httpLocation. Those constants will not occur,
-     * to a reasonable extend, before the constant we are looking for.
-     *
-     * @param templatedPath
-     * @param httpLocationParameterMap
-     */
-    protected static void extractParametersFromPath(String templatedPath,
-                                                    MultipleEntryHashMap httpLocationParameterMap,
-                                                    String requestURL) throws AxisFault {
-
-
-        if (templatedPath != null && !"".equals(templatedPath) && templatedPath.indexOf("{") > -1) {
-            StringBuffer pathTemplate = new StringBuffer(templatedPath);
-
-            // this will hold the index, from which we need to process the request URI
-            int startIndex = 0;
-            int templateStartIndex = 0;
-            int templateEndIndex = 0;
-            int indexOfNextConstant = 0;
-
-            StringBuffer requestURIBuffer ;
-            try {
-                requestURIBuffer = new StringBuffer(URLDecoder.decode(requestURL, "UTF-8"));
-            } catch (UnsupportedEncodingException e) {
-                log.error("Could not decode the query String in the HttpServletRequest");
-                throw new AxisFault("Could not decode the query String in the HttpServletRequest");
-            }
-
-            while (startIndex < requestURIBuffer.length()) {
-                // this will always hold the starting index of a template parameter
-                templateStartIndex = pathTemplate.indexOf("{", templateStartIndex);
-
-                if (templateStartIndex > 0) {
-                    // get the preceding constant part from the template
-                    String constantPart =
-                            pathTemplate.substring(templateEndIndex + 1, templateStartIndex);
-
-                    // get the index of the end of this template param
-                    templateEndIndex = pathTemplate.indexOf("}", templateStartIndex);
-
-                    String parameterName =
-                            pathTemplate.substring(templateStartIndex + 1, templateEndIndex);
-                    // next try to find the next constant
-                    templateStartIndex = pathTemplate.indexOf("{", templateEndIndex);
-
-                    int endIndexOfConstant = requestURIBuffer
-                            .indexOf(constantPart, indexOfNextConstant) + constantPart.length();
-
-                    if (templateEndIndex == pathTemplate.length() - 1 || templateStartIndex == -1) {
-
-                        constantPart =
-                                pathTemplate.substring(templateEndIndex + 1, pathTemplate.length());
-                        indexOfNextConstant =
-                                requestURIBuffer.indexOf(constantPart, endIndexOfConstant);
-
-                        httpLocationParameterMap.put(parameterName, requestURIBuffer.substring(
-                                endIndexOfConstant, indexOfNextConstant));
-                        startIndex = requestURIBuffer.length();
-                    } else {
-
-                        // this is the next constant from the template
-                        constantPart =
-                                pathTemplate.substring(templateEndIndex + 1, templateStartIndex);
-
-                        indexOfNextConstant =
-                                requestURIBuffer.indexOf(constantPart, endIndexOfConstant);
-                        httpLocationParameterMap.put(parameterName, requestURIBuffer.substring(
-                                endIndexOfConstant, indexOfNextConstant));
-                        startIndex = indexOfNextConstant;
-
-                    }
-
-                }
-
-            }
-
-        }
-    }
-
-    private static Map getParameterMap(HttpServletRequest request, String queryParamSeparator)
-            throws AxisFault {
-
-        String encodedQueryString = request.getQueryString();
-        String queryString ;
-        Map parameterMap = new HashMap();
-
-        if (encodedQueryString != null) {
-
-            try {
-                queryString = URLDecoder.decode(encodedQueryString, "UTF-8");
-            } catch (UnsupportedEncodingException e) {
-                log.error("Could not decode the query String in the HttpServletRequest");
-                throw new AxisFault("Could not decode the query String in the HttpServletRequest");
-            }
-
-            if (queryParamSeparator == null || queryParamSeparator.equals("&")) {
-                parameterMap = HttpUtils.parseQueryString(queryString);
-            } else {
-                String parts[] = queryString.split(queryParamSeparator);
-                for (int i = 0; i < parts.length; i++) {
-                    int separator = parts[i].indexOf("=");
-                    String[] value = new String[1];
-                    value[0] = parts[i].substring(separator + 1);
-                    parameterMap.put(parts[i].substring(0, separator), value);
-                }
-            }
-        }
-
-        String contentType = request.getContentType();
-        if (contentType != null && contentType.indexOf(HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA) > -1) {
-            ServletRequestContext servletRequestContext = new ServletRequestContext(request);
-            try {
-                List items = parseRequest(servletRequestContext);
-                Iterator iter = items.iterator();
-                while (iter.hasNext()) {
-                    String[] value = new String[1];
-                    DiskFileItem diskFileItem = (DiskFileItem) iter.next();
-                    value[0] = diskFileItem.getString();
-                    parameterMap.put(diskFileItem.getFieldName(), value);
-                }
-            } catch (FileUploadException e) {
-                log.error("Unable to extract data from Multipart request");
-                throw new AxisFault("Unable to extract data from Multipart request");
-            }
-        } else {
-
-            Enumeration enumeration = request.getParameterNames();
-            while (enumeration.hasMoreElements()) {
-                String paramName = (String) enumeration.nextElement();
-                if (parameterMap.get(paramName) == null) {
-                    parameterMap.put(paramName, request.getParameterValues(paramName));
-                }
-            }
-        }
-
-        return parameterMap;
-    }
-
-    private static List parseRequest(ServletRequestContext requestContext)
-            throws FileUploadException {
-        // Create a factory for disk-based file items
-        FileItemFactory factory = new DiskFileItemFactory();
-        // Create a new file upload handler
-        ServletFileUpload upload = new ServletFileUpload(factory);
-        // Parse the request
-        return upload.parseRequest(requestContext);
-    }
-
 }

Added: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/transport/http/util/URLTemplatingUtilTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/transport/http/util/URLTemplatingUtilTest.java?view=auto&rev=513299
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/transport/http/util/URLTemplatingUtilTest.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/transport/http/util/URLTemplatingUtilTest.java Thu Mar  1 05:03:10 2007
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.transport.http.util;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.description.WSDL2Constants;
+
+import java.net.URL;
+import java.net.MalformedURLException;
+
+import junit.framework.TestCase;
+
+public class URLTemplatingUtilTest extends TestCase {
+
+
+    private MessageContext messageContext;
+
+
+    protected void setUp() throws Exception {
+        messageContext = new MessageContext();
+
+        SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();
+        SOAPEnvelope defaultEnvelope = soapFactory.getDefaultEnvelope();
+
+        messageContext.setEnvelope(defaultEnvelope);
+
+        OMElement bodyFirstElement = soapFactory.createOMElement("TestOperation", null);
+        defaultEnvelope.getBody().addChild(bodyFirstElement);
+
+        soapFactory.createOMElement("FirstName", null, bodyFirstElement).setText("Foo");
+        soapFactory.createOMElement("LastName", null, bodyFirstElement).setText("Bar");
+
+    }
+
+    public void testGetTemplatedURL() throws AxisFault, MalformedURLException {
+        URL testURL = new URL("http://locahost:8080/paramOne/{FirstName}?test=1&lastName={LastName}");
+        URL modifiedURL = URLTemplatingUtil.getTemplatedURL(testURL, messageContext, true);
+
+        System.out.println("original = " + testURL);
+        System.out.println("modifiedURL = " + modifiedURL);
+
+        String expectedURL = "http://locahost:8080/paramOne/Foo?test=1&lastName=Bar";
+        assertEquals(modifiedURL.toString(), expectedURL);
+
+    }
+
+    public void testAppendParametersToURL() throws MalformedURLException, AxisFault {
+        URL testURL = new URL("http://locahost:8080/paramOne");
+        URL modifiedURL = URLTemplatingUtil.appendParametersToURL(messageContext,testURL);
+
+        System.out.println("original = " + testURL);
+        System.out.println("modifiedURL = " + modifiedURL);
+
+        String expectedURL = "http://locahost:8080/paramOne?FirstName=Foo&LastName=Bar";
+        assertEquals(modifiedURL.toString(), expectedURL);
+    }
+
+    public void testQueryParameterSeperator() throws MalformedURLException, AxisFault {
+        URL testURL = new URL("http://locahost:8080/paramOne");
+        messageContext.setProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,";");
+        URL modifiedURL = URLTemplatingUtil.appendParametersToURL(messageContext,testURL);
+
+        System.out.println("original = " + testURL);
+        System.out.println("modifiedURL = " + modifiedURL);
+
+        String expectedURL = "http://locahost:8080/paramOne?FirstName=Foo;LastName=Bar";
+        assertEquals(modifiedURL.toString(), expectedURL);
+    }
+
+    public void testIgnoreUncitedTrue() throws MalformedURLException, AxisFault {
+
+        URL testURL = new URL("http://locahost:8080/paramOne/Foo?test=1");
+        messageContext.setProperty(WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED,"true");
+        URL modifiedURL = URLTemplatingUtil.appendParametersToURL(messageContext,testURL);
+
+        System.out.println("original = " + testURL);
+        System.out.println("modifiedURL = " + modifiedURL);
+
+        String expectedURL = "http://locahost:8080/paramOne/Foo?test=1";
+        assertEquals(modifiedURL.toString(), expectedURL);
+
+    }
+
+    public void testIgnoreUncitedFalse() throws MalformedURLException, AxisFault {
+
+        URL testURL = new URL("http://locahost:8080/paramOne/Foo?test=1");
+        messageContext.setProperty(WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED,"false");
+        URL modifiedURL = URLTemplatingUtil.appendParametersToURL(messageContext,testURL);
+
+        System.out.println("original = " + testURL);
+        System.out.println("modifiedURL = " + modifiedURL);
+
+        String expectedURL = "http://locahost:8080/paramOne/Foo?test=1&FirstName=Foo&LastName=Bar";
+        assertEquals(modifiedURL.toString(), expectedURL);
+
+    }
+
+}



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