cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-7241] Making sure new query params if any are not lost, patch from Ezequiel Rosas Garcia applied with minor updates, This closes #234
Date Fri, 03 Feb 2017 18:07:54 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 63daada33 -> 8be745da6


[CXF-7241] Making sure new query params if any are not lost, patch from Ezequiel Rosas Garcia
applied with minor updates, This closes #234


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/8be745da
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/8be745da
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/8be745da

Branch: refs/heads/master
Commit: 8be745da69954b65fc8a16c36a509f26c5018da3
Parents: 63daada
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Fri Feb 3 18:07:14 2017 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Fri Feb 3 18:07:14 2017 +0000

----------------------------------------------------------------------
 .../apache/cxf/jaxrs/impl/ContainerRequestContextImpl.java   | 8 ++++++--
 .../test/java/org/apache/cxf/systest/jaxrs/BookServer20.java | 5 +++++
 .../cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java       | 8 ++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/8be745da/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ContainerRequestContextImpl.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ContainerRequestContextImpl.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ContainerRequestContextImpl.java
index 1fa9557..94a8ce6 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ContainerRequestContextImpl.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ContainerRequestContextImpl.java
@@ -115,9 +115,13 @@ public class ContainerRequestContextImpl extends AbstractRequestContextImpl
         doSetRequestUri(requestUri);
     }
     
-    public void doSetRequestUri(URI requestUri) throws IllegalStateException {
+    protected void doSetRequestUri(URI requestUri) throws IllegalStateException {
         checkNotPreMatch();
-        HttpUtils.resetRequestURI(m, requestUri.toString());
+        HttpUtils.resetRequestURI(m, requestUri.getRawPath());
+        String query = requestUri.getRawQuery();
+        if (query != null) {
+            m.put(Message.QUERY_STRING, query);
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cxf/blob/8be745da/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java
index be58f50..fac5206 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java
@@ -215,7 +215,12 @@ public class BookServer20 extends AbstractBusTestServerBase {
                 replaceStream(context);
             } else if (path.endsWith("books/check2")) {
                 replaceStream(context);
+            } else if (path.endsWith("books/checkNQuery")) {
+                URI requestURI = URI.create(path.replace("NQuery", "2?a=b"));
+                context.setRequestUri(requestURI);
+                replaceStream(context);
             }
+            
         }
         private void replaceStream(ContainerRequestContext context) {
             InputStream is = new ByteArrayInputStream("123".getBytes());

http://git-wip-us.apache.org/repos/asf/cxf/blob/8be745da/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java
index ba1f2a3..892cfe9 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java
@@ -715,6 +715,14 @@ public class JAXRS20ClientServerBookTest extends AbstractBusClientServerTestBase
         wc.accept("text/plain").type("text/plain");
         assertTrue(wc.post("s", Boolean.class));
     }
+    @Test
+    public void testBookExistsServerAddressOverwriteWithQuery() throws Exception {
+        String address = "http://localhost:" + PORT + "/bookstore/books/checkNQuery?a=b";
+        WebClient wc = WebClient.create(address);
+        WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(10000000);
+        wc.accept("text/plain").type("text/plain");
+        assertTrue(wc.post("s", Boolean.class));
+    }
     
     @Test
     public void testPostBookAsync() throws Exception {


Mime
View raw message