You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2016/09/07 11:42:33 UTC
[1/2] cxf git commit: [CXF-7042] Updating JAXRS multithreaded test as
suggested by Romain
Repository: cxf
Updated Branches:
refs/heads/3.0.x-fixes 0c2020e1d -> 9b177f0ed
[CXF-7042] Updating JAXRS multithreaded test as suggested by Romain
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/9b177f0e
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9b177f0e
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9b177f0e
Branch: refs/heads/3.0.x-fixes
Commit: 9b177f0ed4b34fd63cd0585c788be88a2072257b
Parents: d563bd5
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Wed Sep 7 12:36:56 2016 +0100
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Wed Sep 7 12:42:14 2016 +0100
----------------------------------------------------------------------
.../apache/cxf/systest/jaxrs/JAXRSMultithreadedClientTest.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/9b177f0e/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultithreadedClientTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultithreadedClientTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultithreadedClientTest.java
index 0c93f5c..4f3f44e 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultithreadedClientTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultithreadedClientTest.java
@@ -21,6 +21,7 @@ package org.apache.cxf.systest.jaxrs;
import java.io.InputStream;
import java.util.Collections;
+import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
@@ -279,8 +280,9 @@ public class JAXRSMultithreadedClientTest extends AbstractBusClientServerTestBas
private void verifyResponse(Response response, String actualBookName, String actualHeaderName)
throws Exception {
- assertEquals(actualHeaderName,
- response.getMetadata().getFirst("CustomHeader").toString());
+ List<Object> customHeaders = response.getMetadata().get("CustomHeader");
+ assertEquals(customHeaders.size(), 1);
+ assertEquals(actualHeaderName, customHeaders.get(0).toString());
String responseValue = IOUtils.readStringFromStream((InputStream)response.getEntity());
assertEquals(actualBookName, responseValue);
}
[2/2] cxf git commit: [CXF-7043] Using an initial no-arg
HttpServletRequest.startAsync to support URL-encoded paths correctly,
patch from Tadayoshi Sato applied, This closes #164
Posted by se...@apache.org.
[CXF-7043] Using an initial no-arg HttpServletRequest.startAsync to support URL-encoded paths correctly, patch from Tadayoshi Sato applied, This closes #164
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d563bd50
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d563bd50
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d563bd50
Branch: refs/heads/3.0.x-fixes
Commit: d563bd501f11afffc81de1f96b20ab47f448e344
Parents: 0c2020e
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Wed Sep 7 12:34:33 2016 +0100
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Wed Sep 7 12:42:14 2016 +0100
----------------------------------------------------------------------
.../transport/http/AbstractHTTPDestination.java | 2 +-
.../http/Servlet3ContinuationProvider.java | 2 +-
.../cxf/transport/servlet/BaseUrlHelper.java | 7 +-
.../transport/servlet/BaseUrlHelperTest.java | 114 ++++++++++++++++++
.../servlet/ServletControllerTest.java | 8 +-
.../servlet/servicelist/BaseUrlHelperTest.java | 115 -------------------
.../BookCxfContinuationServlet3Server.java | 82 +++++++++++++
.../systest/jaxrs/BookCxfContinuationStore.java | 1 +
.../JAXRSCxfContinuationsServlet3Test.java | 57 +++++++++
.../jaxrs/JAXRSCxfContinuationsTest.java | 18 +++
10 files changed, 284 insertions(+), 122 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/d563bd50/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
index c8ef130..f5f3727 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
@@ -409,7 +409,7 @@ public abstract class AbstractHTTPDestination
* Propogate in the message a TLSSessionInfo instance representative
* of the TLS-specific information in the HTTP request.
*
- * @param req the Jetty request
+ * @param request the Jetty request
* @param message the Message
*/
private static void propogateSecureSession(HttpServletRequest request,
http://git-wip-us.apache.org/repos/asf/cxf/blob/d563bd50/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Servlet3ContinuationProvider.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Servlet3ContinuationProvider.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Servlet3ContinuationProvider.java
index d8f554c..ab86158 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Servlet3ContinuationProvider.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Servlet3ContinuationProvider.java
@@ -87,7 +87,7 @@ public class Servlet3ContinuationProvider implements ContinuationProvider {
inMessage.getExchange().getInMessage());
callback = inMessage.getExchange().get(ContinuationCallback.class);
blockRestart = PropertyUtils.isTrue(inMessage.getContextualProperty(BLOCK_RESTART));
- context = req.startAsync(req, resp);
+ context = req.startAsync();
context.addListener(this);
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/d563bd50/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/BaseUrlHelper.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/BaseUrlHelper.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/BaseUrlHelper.java
index b12ebd8..4b820c9 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/BaseUrlHelper.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/BaseUrlHelper.java
@@ -47,7 +47,12 @@ public final class BaseUrlHelper {
URI uri = URI.create(reqPrefix);
sb.append(uri.getScheme()).append("://").append(uri.getRawAuthority());
- sb.append(request.getContextPath()).append(request.getServletPath());
+ if (request.getContextPath() != null) {
+ sb.append(request.getContextPath());
+ }
+ if (request.getServletPath() != null) {
+ sb.append(request.getServletPath());
+ }
reqPrefix = sb.toString();
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/d563bd50/rt/transports/http/src/test/java/org/apache/cxf/transport/servlet/BaseUrlHelperTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/test/java/org/apache/cxf/transport/servlet/BaseUrlHelperTest.java b/rt/transports/http/src/test/java/org/apache/cxf/transport/servlet/BaseUrlHelperTest.java
new file mode 100644
index 0000000..a135d76
--- /dev/null
+++ b/rt/transports/http/src/test/java/org/apache/cxf/transport/servlet/BaseUrlHelperTest.java
@@ -0,0 +1,114 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.transport.servlet;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.easymock.EasyMock;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class BaseUrlHelperTest {
+ private String testGetBaseURL(String requestUrl, String contextPath,
+ String servletPath, String pathInfo) {
+ HttpServletRequest req = EasyMock.createMock(HttpServletRequest.class);
+ req.getRequestURL();
+ EasyMock.expectLastCall().andReturn(new StringBuffer(requestUrl));
+
+ req.getContextPath();
+ EasyMock.expectLastCall().andReturn(contextPath).anyTimes();
+ req.getServletPath();
+ EasyMock.expectLastCall().andReturn(servletPath).anyTimes();
+
+ req.getPathInfo();
+ EasyMock.expectLastCall().andReturn(pathInfo).times(2);
+
+ String basePath = contextPath + servletPath;
+ if (basePath.length() == 0) {
+ req.getRequestURI();
+ EasyMock.expectLastCall().andReturn(pathInfo);
+ }
+
+ EasyMock.replay(req);
+ return BaseUrlHelper.getBaseURL(req);
+ }
+
+ @Test
+ public void testGetRequestURLWithRepeatingValues() throws Exception {
+ String url = testGetBaseURL("http://services.com/services/bar", "/services", "", "/bar");
+ Assert.assertEquals("http://services.com/services", url);
+ }
+
+ @Test
+ public void testGetRequestURL() throws Exception {
+ String url = testGetBaseURL("http://localhost:8080/services/bar", "", "/services", "/bar");
+ Assert.assertEquals("http://localhost:8080/services", url);
+ }
+
+ @Test
+ public void testGetRequestURL2() throws Exception {
+ String url = testGetBaseURL("http://localhost:8080/services/bar", "/services", "", "/bar");
+ Assert.assertEquals("http://localhost:8080/services", url);
+ }
+
+ @Test
+ public void testGetRequestURL3() throws Exception {
+ String url = testGetBaseURL("http://localhost:8080/services/bar", "", "", "/services/bar");
+ Assert.assertEquals("http://localhost:8080", url);
+ }
+
+ @Test
+ public void testGetRequestURLSingleMatrixParam() throws Exception {
+ String url = testGetBaseURL("http://localhost:8080/services/bar;a=b", "", "/services", "/bar");
+ Assert.assertEquals("http://localhost:8080/services", url);
+ }
+
+ @Test
+ public void testGetRequestURLMultipleMatrixParam() throws Exception {
+ String url = testGetBaseURL("http://localhost:8080/services/bar;a=b;c=d;e=f",
+ "", "/services", "/bar");
+ Assert.assertEquals("http://localhost:8080/services", url);
+
+ }
+
+ @Test
+ public void testGetRequestURLMultipleMatrixParam2() throws Exception {
+ String url = testGetBaseURL("http://localhost:8080/services/bar;a=b;c=d;e=f", "", "/services",
+ "/bar;a=b;c=d");
+ Assert.assertEquals("http://localhost:8080/services", url);
+
+ }
+
+ @Test
+ public void testGetRequestURLMultipleMatrixParam3() throws Exception {
+ String url = testGetBaseURL("http://localhost:8080/services/bar;a=b;c=d;e=f", "", "/services",
+ "/bar;a=b");
+ Assert.assertEquals("http://localhost:8080/services", url);
+
+ }
+
+ @Test
+ public void testGetRequestURLMultipleMatrixParam4() throws Exception {
+ String url = testGetBaseURL("http://localhost:8080/services/bar;a=b;c=d;e=f;", "", "/services",
+ "/bar;a=b");
+ Assert.assertEquals("http://localhost:8080/services", url);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/d563bd50/rt/transports/http/src/test/java/org/apache/cxf/transport/servlet/ServletControllerTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/test/java/org/apache/cxf/transport/servlet/ServletControllerTest.java b/rt/transports/http/src/test/java/org/apache/cxf/transport/servlet/ServletControllerTest.java
index d1172c7..0361315 100644
--- a/rt/transports/http/src/test/java/org/apache/cxf/transport/servlet/ServletControllerTest.java
+++ b/rt/transports/http/src/test/java/org/apache/cxf/transport/servlet/ServletControllerTest.java
@@ -55,9 +55,9 @@ public class ServletControllerTest extends Assert {
req.getPathInfo();
EasyMock.expectLastCall().andReturn(pathInfo).anyTimes();
req.getContextPath();
- EasyMock.expectLastCall().andReturn("");
+ EasyMock.expectLastCall().andReturn("").anyTimes();
req.getServletPath();
- EasyMock.expectLastCall().andReturn("");
+ EasyMock.expectLastCall().andReturn("").anyTimes();
req.setAttribute(Message.BASE_PATH, "http://localhost:8080");
EasyMock.expectLastCall().anyTimes();
req.getRequestURI();
@@ -98,9 +98,9 @@ public class ServletControllerTest extends Assert {
req.getPathInfo();
EasyMock.expectLastCall().andReturn(null).anyTimes();
req.getContextPath();
- EasyMock.expectLastCall().andReturn("");
+ EasyMock.expectLastCall().andReturn("").anyTimes();
req.getServletPath();
- EasyMock.expectLastCall().andReturn("");
+ EasyMock.expectLastCall().andReturn("").anyTimes();
req.getRequestURI();
EasyMock.expectLastCall().andReturn("/services").times(2);
http://git-wip-us.apache.org/repos/asf/cxf/blob/d563bd50/rt/transports/http/src/test/java/org/apache/cxf/transport/servlet/servicelist/BaseUrlHelperTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/test/java/org/apache/cxf/transport/servlet/servicelist/BaseUrlHelperTest.java b/rt/transports/http/src/test/java/org/apache/cxf/transport/servlet/servicelist/BaseUrlHelperTest.java
deleted file mode 100644
index 8525a72..0000000
--- a/rt/transports/http/src/test/java/org/apache/cxf/transport/servlet/servicelist/BaseUrlHelperTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.cxf.transport.servlet.servicelist;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.cxf.transport.servlet.BaseUrlHelper;
-import org.easymock.EasyMock;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class BaseUrlHelperTest {
- private String testGetBaseURL(String requestUrl, String contextPath,
- String servletPath, String pathInfo) {
- HttpServletRequest req = EasyMock.createMock(HttpServletRequest.class);
- req.getRequestURL();
- EasyMock.expectLastCall().andReturn(new StringBuffer(requestUrl));
-
- req.getContextPath();
- EasyMock.expectLastCall().andReturn(contextPath);
- req.getServletPath();
- EasyMock.expectLastCall().andReturn(servletPath);
-
- req.getPathInfo();
- EasyMock.expectLastCall().andReturn(pathInfo).times(2);
-
- String basePath = contextPath + servletPath;
- if (basePath.length() == 0) {
- req.getRequestURI();
- EasyMock.expectLastCall().andReturn(pathInfo);
- }
-
- EasyMock.replay(req);
- return BaseUrlHelper.getBaseURL(req);
- }
-
- @Test
- public void testGetRequestURLWithRepeatingValues() throws Exception {
- String url = testGetBaseURL("http://services.com/services/bar", "/services", "", "/bar");
- Assert.assertEquals("http://services.com/services", url);
- }
-
- @Test
- public void testGetRequestURL() throws Exception {
- String url = testGetBaseURL("http://localhost:8080/services/bar", "", "/services", "/bar");
- Assert.assertEquals("http://localhost:8080/services", url);
- }
-
- @Test
- public void testGetRequestURL2() throws Exception {
- String url = testGetBaseURL("http://localhost:8080/services/bar", "/services", "", "/bar");
- Assert.assertEquals("http://localhost:8080/services", url);
- }
-
- @Test
- public void testGetRequestURL3() throws Exception {
- String url = testGetBaseURL("http://localhost:8080/services/bar", "", "", "/services/bar");
- Assert.assertEquals("http://localhost:8080", url);
- }
-
- @Test
- public void testGetRequestURLSingleMatrixParam() throws Exception {
- String url = testGetBaseURL("http://localhost:8080/services/bar;a=b", "", "/services", "/bar");
- Assert.assertEquals("http://localhost:8080/services", url);
- }
-
- @Test
- public void testGetRequestURLMultipleMatrixParam() throws Exception {
- String url = testGetBaseURL("http://localhost:8080/services/bar;a=b;c=d;e=f",
- "", "/services", "/bar");
- Assert.assertEquals("http://localhost:8080/services", url);
-
- }
-
- @Test
- public void testGetRequestURLMultipleMatrixParam2() throws Exception {
- String url = testGetBaseURL("http://localhost:8080/services/bar;a=b;c=d;e=f", "", "/services",
- "/bar;a=b;c=d");
- Assert.assertEquals("http://localhost:8080/services", url);
-
- }
-
- @Test
- public void testGetRequestURLMultipleMatrixParam3() throws Exception {
- String url = testGetBaseURL("http://localhost:8080/services/bar;a=b;c=d;e=f", "", "/services",
- "/bar;a=b");
- Assert.assertEquals("http://localhost:8080/services", url);
-
- }
-
- @Test
- public void testGetRequestURLMultipleMatrixParam4() throws Exception {
- String url = testGetBaseURL("http://localhost:8080/services/bar;a=b;c=d;e=f;", "", "/services",
- "/bar;a=b");
- Assert.assertEquals("http://localhost:8080/services", url);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/cxf/blob/d563bd50/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookCxfContinuationServlet3Server.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookCxfContinuationServlet3Server.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookCxfContinuationServlet3Server.java
new file mode 100644
index 0000000..06ae8a5
--- /dev/null
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookCxfContinuationServlet3Server.java
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.jaxrs;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.ServletHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+
+public class BookCxfContinuationServlet3Server extends AbstractBusTestServerBase {
+ public static final String PORT = allocatePort(BookCxfContinuationServlet3Server.class);
+
+ protected void run() {
+ String busFactory = System.getProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME);
+ System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, "org.apache.cxf.bus.CXFBusFactory");
+ try {
+ CXFNonSpringServlet cxf = new CXFNonSpringServlet();
+ httpServer(cxf).start();
+ serverFactory(cxf.getBus()).create();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ if (busFactory != null) {
+ System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, busFactory);
+ } else {
+ System.clearProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME);
+ }
+ }
+ }
+
+ private Server httpServer(CXFNonSpringServlet cxf) {
+ Server server = new Server(Integer.parseInt(PORT));
+ ServletHandler handler = new ServletHandler();
+ server.setHandler(handler);
+ handler.addServletWithMapping(new ServletHolder(cxf), "/*");
+ return server;
+ }
+
+ private JAXRSServerFactoryBean serverFactory(Bus bus) {
+ JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
+ sf.setBus(bus);
+ sf.setResourceClasses(BookCxfContinuationStore.class);
+ sf.setResourceProvider(BookCxfContinuationStore.class,
+ new SingletonResourceProvider(new BookCxfContinuationStore()));
+ sf.setAddress("/");
+ return sf;
+ }
+
+ public static void main(String[] args) {
+ try {
+ BookCxfContinuationServlet3Server s = new BookCxfContinuationServlet3Server();
+ s.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ System.exit(-1);
+ } finally {
+ System.out.println("done!");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/d563bd50/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookCxfContinuationStore.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookCxfContinuationStore.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookCxfContinuationStore.java
index f1e98b6..b6204c3 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookCxfContinuationStore.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookCxfContinuationStore.java
@@ -169,6 +169,7 @@ public class BookCxfContinuationStore {
books.put("3", "CXF in Action3");
books.put("4", "CXF in Action4");
books.put("5", "CXF in Action5");
+ books.put("A B C", "CXF in Action A B C");
}
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/d563bd50/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSCxfContinuationsServlet3Test.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSCxfContinuationsServlet3Test.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSCxfContinuationsServlet3Test.java
new file mode 100644
index 0000000..e3bedd2
--- /dev/null
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSCxfContinuationsServlet3Test.java
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.jaxrs;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class JAXRSCxfContinuationsServlet3Test extends AbstractBusClientServerTestBase {
+ public static final String PORT = BookCxfContinuationServlet3Server.PORT;
+
+ @BeforeClass
+ public static void startServers() throws Exception {
+ AbstractResourceInfo.clearAllMaps();
+ createStaticBus();
+ assertTrue("server did not launch correctly",
+ launchServer(BookCxfContinuationServlet3Server.class));
+ }
+
+ @Test
+ public void testEncodedURL() throws Exception {
+ String id = "A%20B%20C"; // "A B C"
+ GetMethod get = new GetMethod("http://localhost:" + PORT + "/bookstore/books/" + id);
+ HttpClient httpclient = new HttpClient();
+
+ try {
+ int result = httpclient.executeMethod(get);
+ assertEquals("Encoded path '/" + id + "' is not handled successfully",
+ 200, result);
+ assertEquals("Book description for id " + id + " is wrong",
+ "CXF in Action A B C", get.getResponseBodyAsString());
+ } finally {
+ // Release current connection to the connection pool once you are done
+ get.releaseConnection();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/d563bd50/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSCxfContinuationsTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSCxfContinuationsTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSCxfContinuationsTest.java
index a2bf33f..b6849f8 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSCxfContinuationsTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSCxfContinuationsTest.java
@@ -124,4 +124,22 @@ public class JAXRSCxfContinuationsTest extends AbstractBusClientServerTestBase {
}
}
+
+ @Test
+ public void testEncodedURL() throws Exception {
+ String id = "A%20B%20C"; // "A B C"
+ GetMethod get = new GetMethod("http://localhost:" + PORT + "/bookstore/books/" + id);
+ HttpClient httpclient = new HttpClient();
+
+ try {
+ int result = httpclient.executeMethod(get);
+ assertEquals("Encoded path '/" + id + "' is not handled successfully",
+ 200, result);
+ assertEquals("Book description for id " + id + " is wrong",
+ "CXF in Action A B C", get.getResponseBodyAsString());
+ } finally {
+ // Release current connection to the connection pool once you are done
+ get.releaseConnection();
+ }
+ }
}