cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1030193 - in /cxf/branches/2.3.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...
Date Tue, 02 Nov 2010 19:36:42 GMT
Author: sergeyb
Date: Tue Nov  2 19:36:42 2010
New Revision: 1030193

URL: http://svn.apache.org/viewvc?rev=1030193&view=rev
Log:
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.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov  2 19:36:42 2010
@@ -1 +1 @@
-/cxf/trunk:1027274,1027462,1027509,1027553,1027599,1030053
+/cxf/trunk:1027274,1027462,1027509,1027553,1027599,1030053,1030189

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Nov  2 19:36:42 2010
@@ -1 +1 @@
-/cxf/trunk:1-1022129,1022154,1022194,1022401-1022402,1022911,1023068,1023121,1023597-1026352,1026549,1026551,1027244,1027269,1027274,1027462,1027509,1027553,1027599,1028170,1029943,1030053
+/cxf/trunk:1-1022129,1022154,1022194,1022401-1022402,1022911,1023068,1023121,1023597-1026352,1026549,1026551,1027244,1027269,1027274,1027462,1027509,1027553,1027599,1028170,1029943,1030053,1030189

Modified: cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?rev=1030193&r1=1030192&r2=1030193&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
Tue Nov  2 19:36:42 2010
@@ -181,7 +181,7 @@ public class ServletController extends A
                             return;
                         }   
                     }
-                } else if ("/".equals(address) || address.length() == 0) {
+                } else {
                     updateDests(request);
                 }
                 

Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java?rev=1030193&r1=1030192&r2=1030193&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
Tue Nov  2 19:36:42 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.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java?rev=1030193&r1=1030192&r2=1030193&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
Tue Nov  2 19:36:42 2010
@@ -24,7 +24,6 @@ import java.io.FileInputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.HttpURLConnection;
-import java.net.Socket;
 import java.net.URL;
 import java.net.URLConnection;
 
@@ -100,22 +99,7 @@ public class JAXRSClientServerResourceJa
         httpUrlConnection.disconnect();
     }
     
-    @Test
-    public void testPostPetStatus2() throws Exception {
-        
-        
-        Socket s = new Socket("localhost", Integer.parseInt(PORT));
-        IOUtils.copyAndCloseInput(getClass().getResource("resources/formRequest.txt").openStream(),

-                                  s.getOutputStream());
-
-        s.getOutputStream().flush();
-        try {
-            assertTrue("Wrong status returned", getStringFromInputStream(s.getInputStream())
-                       .contains("open"));  
-        } finally {
-            s.close();
-        }
-    }
+    
     
     private String getStringFromInputStream(InputStream in) throws Exception {
         return IOUtils.toString(in);

Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java?rev=1030193&r1=1030192&r2=1030193&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java
Tue Nov  2 19:36:42 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.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt?rev=1030193&r1=1030192&r2=1030193&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt
(original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt
Tue Nov  2 19:36:42 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.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml?rev=1030193&r1=1030192&r2=1030193&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml
(original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml
Tue Nov  2 19:36:42 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"/>



Mime
View raw message