cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1004346 - in /cxf/branches/2.2.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/client/ rt/frontend/jaxr...
Date Mon, 04 Oct 2010 18:08:40 GMT
Author: sergeyb
Date: Mon Oct  4 18:08:40 2010
New Revision: 1004346

URL: http://svn.apache.org/viewvc?rev=1004346&view=rev
Log:
Merged revisions 1004334,1004341 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1004334 | sergeyb | 2010-10-04 18:52:54 +0100 (Mon, 04 Oct 2010) | 1 line
  
  Updating ServletDestination to return a proper base address in case of destination address
being overwritten
........
  r1004341 | sergeyb | 2010-10-04 19:03:21 +0100 (Mon, 04 Oct 2010) | 1 line
  
  A hack to ensure that a + contained in UriBuilder.replaceQuery is retained but is encoded
otherwise
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/client/WebClientTest.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
    cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
    svn:mergeinfo = /cxf/trunk:1004334-1004341

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java?rev=1004346&r1=1004345&r2=1004346&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
Mon Oct  4 18:08:40 2010
@@ -598,7 +598,7 @@ public class UriBuilderImpl extends UriB
             // of quertyParam are encoded as '+'
             queryValue = queryValue.replace(" ", "%20");
         }
-        query = JAXRSUtils.getStructuredParams(queryValue, "&", false, false);
+        query = JAXRSUtils.getStructuredParams(queryValue, "&", false, true);
         return this;
     }
 
@@ -667,9 +667,7 @@ public class UriBuilderImpl extends UriB
             Map.Entry<String, List<String>> entry = it.next();
             for (Iterator<String> sit = entry.getValue().iterator(); sit.hasNext();)
{
                 String val = sit.next();
-                if (fromEncoded) {
-                    val = HttpUtils.encodePartiallyEncoded(val, isQuery);
-                } else if (isQuery && !val.startsWith("{") && !val.endsWith("}"))
{ 
+                if (fromEncoded  || (isQuery && !val.startsWith("{") && !val.endsWith("}")))
{ 
                     val = HttpUtils.encodePartiallyEncoded(val, isQuery);
                 }
                 b.append(entry.getKey());

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java?rev=1004346&r1=1004345&r2=1004346&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
Mon Oct  4 18:08:40 2010
@@ -64,7 +64,7 @@ public final class HttpUtils {
     
     // there are more of such characters, ex, '*' but '*' is not affected by UrlEncode
     private static final String PATH_RESERVED_CHARACTERS = "=@";
-    private static final String QUERY_RESERVED_CHARACTERS = "?/+";
+    private static final String QUERY_RESERVED_CHARACTERS = "?/";
     
     private HttpUtils() {
     }

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java?rev=1004346&r1=1004345&r2=1004346&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
Mon Oct  4 18:08:40 2010
@@ -935,8 +935,8 @@ public final class JAXRSUtils {
                 String value = null;
                 if (values.length == 1) {
                     value = "";
-                } else if (decode) {
-                    value = (";".equals(sep) || !decodePlus)
+                } else if (decode || (decodePlus && values[1].contains("+"))) {
+                    value = (";".equals(sep))
                         ? HttpUtils.pathDecode(values[1]) : HttpUtils.urlDecode(values[1]);

                 } else {
                     value = values[1];

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/client/WebClientTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/client/WebClientTest.java?rev=1004346&r1=1004345&r2=1004346&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/client/WebClientTest.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/client/WebClientTest.java
Mon Oct  4 18:08:40 2010
@@ -33,8 +33,8 @@ public class WebClientTest extends Asser
     @Test
     public void testEncoding() {
         URI u = WebClient.create("http://foo").path("bar+ %2B").matrix("a", "value+ ")
-            .query("b", "bv+ ").getCurrentURI();
-        assertEquals("http://foo/bar+%20%2B;a=value+%20?b=bv++", u.toString());
+            .query("b", "bv+ %2B").getCurrentURI();
+        assertEquals("http://foo/bar+%20%2B;a=value+%20?b=bv%2B+%2B", u.toString());
     }
     
     @Test

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java?rev=1004346&r1=1004345&r2=1004346&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
Mon Oct  4 18:08:40 2010
@@ -167,7 +167,7 @@ public class UriBuilderImplTest extends 
             .matrixParam("m", "m1 ", "m2+%20")
             .queryParam("q", "q1 ", "q2+q3%20").clone().buildFromEncoded("a+ ", "b%2B%20
");   
         assertEquals("URI is not built correctly", 
-                     "http://bar/a+%20/b%2B%20%20;m=m1%20;m=m2+%20?q=q1+&q=q2+q3%20",

+                     "http://bar/a+%20/b%2B%20%20;m=m1%20;m=m2+%20?q=q1+&q=q2%2Bq3%20",

                      newUri.toString());
     }
     
@@ -176,7 +176,7 @@ public class UriBuilderImplTest extends 
         URI uri = new URI("http://bar/foo+%20%2B?q=a+b%20%2B");
         URI newUri = new UriBuilderImpl(uri).buildFromEncoded();   
         assertEquals("URI is not built correctly", 
-                     "http://bar/foo+%20%2B?q=a+b%20%2B", newUri.toString());
+                     "http://bar/foo+%20%2B?q=a%2Bb%20%2B", newUri.toString());
     }
     
     @Test
@@ -215,7 +215,7 @@ public class UriBuilderImplTest extends 
     public void testEncodedAddedQuery() throws Exception {
         URI uri = new URI("http://bar");
         URI newUri = new UriBuilderImpl(uri).queryParam("q", "a+b%20%2B").buildFromEncoded();
  
-        assertEquals("URI is not built correctly", "http://bar?q=a+b%20%2B", newUri.toString());
+        assertEquals("URI is not built correctly", "http://bar?q=a%2Bb%20%2B", newUri.toString());
     }
     
     @Test

Modified: cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java?rev=1004346&r1=1004345&r2=1004346&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
Mon Oct  4 18:08:40 2010
@@ -20,6 +20,7 @@
 package org.apache.cxf.transport.servlet;
 
 import java.io.IOException;
+import java.net.URI;
 import java.util.logging.Logger;
 
 import javax.servlet.ServletConfig;
@@ -99,7 +100,13 @@ public class ServletDestination extends 
  
     }
     protected String getBasePath(String contextPath) throws IOException {
-        return contextPath + getAddress().getAddress().getValue();
+        
+        String address = getAddress().getAddress().getValue();
+        if (address.startsWith("http")) {
+            return URI.create(address).getPath();
+        }
+        
+        return contextPath + address;
     }
     
     @Override



Mime
View raw message