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 2010/11/02 20:48:22 UTC
svn commit: r1030198 - in /cxf/branches/2.2.x-fixes: ./
rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/
systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/
systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/ s...
Author: sergeyb
Date: Tue Nov 2 19:48:22 2010
New Revision: 1030198
URL: http://svn.apache.org/viewvc?rev=1030198&view=rev
Log:
Merged revisions 1030193 via svnmerge from
https://svn.apache.org/repos/asf/cxf/branches/2.3.x-fixes
................
r1030193 | sergeyb | 2010-11-02 19:36:42 +0000 (Tue, 02 Nov 2010) | 9 lines
Merged revisions 1030189 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1030189 | sergeyb | 2010-11-02 19:33:23 +0000 (Tue, 02 Nov 2010) | 1 line
[CXF-3090] : Support for request URIs with no trailing slashes
........
................
Modified:
cxf/branches/2.2.x-fixes/ (props changed)
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java
cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt
cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 2 19:48:22 2010
@@ -1,2 +1,2 @@
-/cxf/branches/2.3.x-fixes:1027513,1027608,1030055
-/cxf/trunk:1027509,1027599,1030053
+/cxf/branches/2.3.x-fixes:1027513,1027608,1030055,1030193
+/cxf/trunk:1027509,1027599,1030053,1030189
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?rev=1030198&r1=1030197&r2=1030198&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java (original)
+++ cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java Tue Nov 2 19:48:22 2010
@@ -179,7 +179,7 @@ public class ServletController extends A
return;
}
}
- } else if ("/".equals(address) || address.length() == 0) {
+ } else {
updateDests(request);
}
Modified: cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java?rev=1030198&r1=1030197&r2=1030198&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java (original)
+++ cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java Tue Nov 2 19:48:22 2010
@@ -68,9 +68,33 @@ public class JAXRSClientServerResourceCr
}
@Test
+ public void testBasePetStoreWithoutTrailingSlash() throws Exception {
+
+ String endpointAddress = "http://localhost:" + PORT + "/webapp/resources";
+ WebClient client = WebClient.create(endpointAddress);
+ HTTPConduit conduit = WebClient.getConfig(client).getHttpConduit();
+ conduit.getClient().setReceiveTimeout(1000000);
+ conduit.getClient().setConnectionTimeout(1000000);
+ String value = client.accept("text/plain").get(String.class);
+ assertEquals(PetStore.CLOSED, value);
+ }
+
+ @Test
+ public void testBasePetStore() throws Exception {
+
+ String endpointAddress = "http://localhost:" + PORT + "/webapp/resources/";
+ WebClient client = WebClient.create(endpointAddress);
+ HTTPConduit conduit = WebClient.getConfig(client).getHttpConduit();
+ conduit.getClient().setReceiveTimeout(1000000);
+ conduit.getClient().setConnectionTimeout(1000000);
+ String value = client.accept("text/plain").get(String.class);
+ assertEquals(PetStore.CLOSED, value);
+ }
+
+ @Test
public void testMultipleRootsWadl() throws Exception {
- List<Element> resourceEls = getWadlResourcesInfo("http://localhost:" + PORT + "/webapp/",
- "http://localhost:" + PORT + "/webapp/", 2);
+ List<Element> resourceEls = getWadlResourcesInfo("http://localhost:" + PORT + "/webapp/resources",
+ "http://localhost:" + PORT + "/webapp/resources", 2);
String path1 = resourceEls.get(0).getAttribute("path");
int bookStoreInd = path1.contains("/bookstore") ? 0 : 1;
int petStoreInd = bookStoreInd == 0 ? 1 : 0;
@@ -80,22 +104,22 @@ public class JAXRSClientServerResourceCr
@Test
public void testBookStoreWadl() throws Exception {
- List<Element> resourceEls = getWadlResourcesInfo("http://localhost:" + PORT + "/webapp/",
- "http://localhost:" + PORT + "/webapp/bookstore", 1);
+ List<Element> resourceEls = getWadlResourcesInfo("http://localhost:" + PORT + "/webapp/resources",
+ "http://localhost:" + PORT + "/webapp/resources/bookstore", 1);
checkBookStoreInfo(resourceEls.get(0));
}
@Test
public void testPetStoreWadl() throws Exception {
- List<Element> resourceEls = getWadlResourcesInfo("http://localhost:" + PORT + "/webapp/",
- "http://localhost:" + PORT + "/webapp/petstore", 1);
+ List<Element> resourceEls = getWadlResourcesInfo("http://localhost:" + PORT + "/webapp/resources",
+ "http://localhost:" + PORT + "/webapp/resources/petstore", 1);
checkPetStoreInfo(resourceEls.get(0));
}
@Test
public void testPetStoreSource() throws Exception {
try {
- WebClient wc = WebClient.create("http://localhost:" + PORT + "/webapp/petstore");
+ WebClient wc = WebClient.create("http://localhost:" + PORT + "/webapp/resources/petstore");
HTTPConduit conduit = WebClient.getConfig(wc).getHttpConduit();
conduit.getClient().setReceiveTimeout(1000000);
conduit.getClient().setConnectionTimeout(1000000);
@@ -160,7 +184,7 @@ public class JAXRSClientServerResourceCr
}
private void checkPetStoreInfo(Element resource) {
- assertEquals("/petstore/", resource.getAttribute("path"));
+ assertEquals("/", resource.getAttribute("path"));
}
private List<Element> getWadlResourcesInfo(String baseURI, String requestURI, int size) throws Exception {
@@ -185,7 +209,7 @@ public class JAXRSClientServerResourceCr
public void testGetBook123() throws Exception {
String endpointAddress =
- "http://localhost:" + PORT + "/webapp/bookstore/books/123";
+ "http://localhost:" + PORT + "/webapp/resources/bookstore/books/123";
URL url = new URL(endpointAddress);
URLConnection connect = url.openConnection();
connect.addRequestProperty("Accept", "application/json");
@@ -206,7 +230,7 @@ public class JAXRSClientServerResourceCr
public void testGetBookNotFound() throws Exception {
String endpointAddress =
- "http://localhost:" + PORT + "/webapp/bookstore/books/12345";
+ "http://localhost:" + PORT + "/webapp/resources/bookstore/books/12345";
URL url = new URL(endpointAddress);
HttpURLConnection connect = (HttpURLConnection)url.openConnection();
connect.addRequestProperty("Accept", "text/plain,application/xml");
@@ -226,7 +250,7 @@ public class JAXRSClientServerResourceCr
public void testGetBookNotExistent() throws Exception {
String endpointAddress =
- "http://localhost:" + PORT + "/webapp/bookstore/nonexistent";
+ "http://localhost:" + PORT + "/webapp/resources/bookstore/nonexistent";
URL url = new URL(endpointAddress);
HttpURLConnection connect = (HttpURLConnection)url.openConnection();
connect.addRequestProperty("Accept", "application/xml");
@@ -243,7 +267,7 @@ public class JAXRSClientServerResourceCr
public void testPostPetStatus() throws Exception {
String endpointAddress =
- "http://localhost:" + PORT + "/webapp/petstore/pets";
+ "http://localhost:" + PORT + "/webapp/resources/petstore/pets";
URL url = new URL(endpointAddress);
HttpURLConnection httpUrlConnection = (HttpURLConnection)url.openConnection();
Modified: cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java?rev=1030198&r1=1030197&r2=1030198&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java (original)
+++ cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java Tue Nov 2 19:48:22 2010
@@ -29,7 +29,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
-@Path("/petstore/")
+@Path("/")
public class PetStore {
public static final String CLOSED = "The Pet Store is closed";
@@ -38,7 +38,14 @@ public class PetStore {
}
@GET
- @Path("/pets/{petId}/")
+ @Produces("text/plain")
+ public Response getBaseStatus() throws Exception {
+
+ return Response.ok(CLOSED).build();
+ }
+
+ @GET
+ @Path("/petstore/pets/{petId}/")
@Produces("text/xml")
public Response getStatus(@PathParam("petId")
String petId) throws Exception {
@@ -47,11 +54,10 @@ public class PetStore {
}
@POST
- @Path("/pets/")
+ @Path("/petstore/pets/")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces("text/xml")
public Response updateStatus(MultivaluedMap<String, String> params) throws Exception {
- System.out.println(params);
return Response.ok(params.getFirst("status")).build();
}
}
Modified: cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt?rev=1030198&r1=1030197&r2=1030198&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt (original)
+++ cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt Tue Nov 2 19:48:22 2010
@@ -1,4 +1,4 @@
-POST /webapp/petstore/pets HTTP/1.1
+POST /webapp/resources/petstore/pets HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: en-ie
Content-Type: application/x-www-form-urlencoded
Modified: cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml?rev=1030198&r1=1030197&r2=1030198&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml (original)
+++ cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml Tue Nov 2 19:48:22 2010
@@ -27,7 +27,7 @@ http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd">
<jaxrs:server id="bookservice"
- address="/">
+ address="/resources">
<jaxrs:serviceBeans>
<ref bean="petstore"/>
<ref bean="bookstore"/>