cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1158178 - in /cxf/trunk: rt/transports/http/src/main/java/org/apache/cxf/transport/http/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/
Date Tue, 16 Aug 2011 10:05:38 GMT
Author: sergeyb
Date: Tue Aug 16 10:05:38 2011
New Revision: 1158178

URL: http://svn.apache.org/viewvc?rev=1158178&view=rev
Log:
[CXF-3620] Minor update to check empty strings for PUT requests

Modified:
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=1158178&r1=1158177&r2=1158178&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Tue Aug 16 10:05:38 2011
@@ -555,7 +555,11 @@ public class HTTPConduit 
         if (HTTP_PUT_METHOD.equals(httpMethod)) {
             MessageContentsList objs = MessageContentsList.getContentsList(message);
             if (objs != null && objs.size() > 0) {
-                return true;
+                Object obj = objs.get(0);
+                if (obj.getClass() != String.class 
+                    || (obj.getClass() == String.class && ((String)obj).length()
> 0)) {
+                    return true;
+                }
             }
         }
         return false;

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java?rev=1158178&r1=1158177&r2=1158178&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java Tue
Aug 16 10:05:38 2011
@@ -132,6 +132,11 @@ public class BookStore {
         }
     }
     
+    @PUT
+    @Path("emptyput")
+    public void emptyput() {
+    }
+    
     @POST
     public void emptypostNoPath() {
         emptypost();

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=1158178&r1=1158177&r2=1158178&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
Tue Aug 16 10:05:38 2011
@@ -70,7 +70,7 @@ public class JAXRSClientServerBookTest e
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue("server did not launch correctly",
-                   launchServer(BookServer.class, true));
+                   launchServer(BookServer.class));
     }
     
     @Test
@@ -591,13 +591,26 @@ public class JAXRSClientServerBookTest e
         WebClient wc = 
             WebClient.create("http://localhost:" 
                              + PORT + "/bookstore/emptypost");
-        WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(10000000L);
         Response response = wc.post(null);
         assertEquals(204, response.getStatus());
         assertNull(response.getMetadata().getFirst("Content-Type"));
     }
     
     @Test
+    public void testEmptyPut() throws Exception {
+        WebClient wc = 
+            WebClient.create("http://localhost:" 
+                             + PORT + "/bookstore/emptyput");
+        Response response = wc.put(null);
+        assertEquals(204, response.getStatus());
+        assertNull(response.getMetadata().getFirst("Content-Type"));
+        
+        response = wc.put("");
+        assertEquals(204, response.getStatus());
+        assertNull(response.getMetadata().getFirst("Content-Type"));
+    }
+    
+    @Test
     public void testEmptyPostProxy() throws Exception {
         String address = "http://localhost:" + PORT;
         JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); 



Mime
View raw message