axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kei...@apache.org
Subject svn commit: r525464 - in /webservices/axis2/branches/java/1_2/modules/kernel: src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java test/org/apache/axis2/transport/http/util/URLTemplatingUtilTest.java
Date Wed, 04 Apr 2007 08:56:57 GMT
Author: keithc
Date: Wed Apr  4 01:56:56 2007
New Revision: 525464

URL: http://svn.apache.org/viewvc?view=rev&rev=525464
Log:
Fix for Axis2-2470


Modified:
    webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java
    webservices/axis2/branches/java/1_2/modules/kernel/test/org/apache/axis2/transport/http/util/URLTemplatingUtilTest.java

Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java?view=diff&rev=525464&r1=525463&r2=525464
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java
(original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/util/URLTemplatingUtil.java
Wed Apr  4 01:56:56 2007
@@ -202,13 +202,18 @@
         int separator = httpLocation.indexOf('{');
             try {
 
-        if (separator > 0) {
+        if (separator > -1) {
             replacedQuery = URIEncoderDecoder.quoteIllegal(
                     URLTemplatingUtil.applyURITemplating(messageContext, httpLocation, detach),
                     WSDL2Constants.LEGAL_CHARACTERS_IN_URL);
 
         }
-                URI targetURI = new URI(targetURL.toString() + "/");
+                URI targetURI;
+                if (replacedQuery.charAt(0) == '?') {
+                    targetURI = new URI(targetURL.toString());
+                } else {
+                    targetURI = new URI(targetURL.toString() + "/");
+                }
                 
                 URI appendedURI = targetURI.resolve(replacedQuery);
                 targetURL = appendedURI.toURL(); 

Modified: webservices/axis2/branches/java/1_2/modules/kernel/test/org/apache/axis2/transport/http/util/URLTemplatingUtilTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/test/org/apache/axis2/transport/http/util/URLTemplatingUtilTest.java?view=diff&rev=525464&r1=525463&r2=525464
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/test/org/apache/axis2/transport/http/util/URLTemplatingUtilTest.java
(original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/test/org/apache/axis2/transport/http/util/URLTemplatingUtilTest.java
Wed Apr  4 01:56:56 2007
@@ -52,7 +52,8 @@
 
     public void testGetTemplatedURL() throws AxisFault, MalformedURLException {
         URL testURL =
-                new URL("http://locahost:8080/paramOne/{FirstName}?test=1&lastName={LastName}");
+                new URL("http://locahost:8080/paramOne");
+        messageContext.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, "{FirstName}?test=1&lastName={LastName}");
         URL modifiedURL = URLTemplatingUtil.getTemplatedURL(testURL, messageContext, true);
 
         System.out.println("original = " + testURL);
@@ -65,6 +66,7 @@
 
     public void testAppendParametersToURL() throws MalformedURLException, AxisFault {
         URL testURL = new URL("http://locahost:8080/paramOne");
+        messageContext.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, null);
         URL modifiedURL = URLTemplatingUtil.appendQueryParameters(messageContext,testURL);
 
         System.out.println("original = " + testURL);
@@ -76,6 +78,7 @@
 
     public void testQueryParameterSeperator() throws MalformedURLException, AxisFault {
         URL testURL = new URL("http://locahost:8080/paramOne");
+        messageContext.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, null);
         messageContext.setProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,";");
         URL modifiedURL = URLTemplatingUtil.appendQueryParameters(messageContext,testURL);
 
@@ -86,24 +89,11 @@
         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.appendQueryParameters(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");
+        messageContext.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, null);
         URL modifiedURL = URLTemplatingUtil.appendQueryParameters(messageContext,testURL);
 
         System.out.println("original = " + testURL);



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