cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r835633 - in /cxf/trunk: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ rt/transports/http/src/main/java/org/apache/cxf/transport/http/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/
Date Thu, 12 Nov 2009 23:17:41 GMT
Author: sergeyb
Date: Thu Nov 12 23:17:41 2009
New Revision: 835633

URL: http://svn.apache.org/viewvc?rev=835633&view=rev
Log:
Minor update for WebClients to support empty POSTS

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
    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/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java?rev=835633&r1=835632&r2=835633&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java Thu
Nov 12 23:17:41 2009
@@ -565,6 +565,8 @@
             MessageContentsList contents = new MessageContentsList(body);
             m.setContent(List.class, contents);
             m.getInterceptorChain().add(new BodyWriter());
+        } else if ("POST".equals(httpMethod)) {
+            m.put("org.apache.cxf.post.empty", "true");
         }
         
         try {

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=835633&r1=835632&r2=835633&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
Thu Nov 12 23:17:41 2009
@@ -1937,6 +1937,9 @@
                 && !"PUT".equals(connection.getRequestMethod())) {
                 return;
             }
+            if (outMessage.get("org.apache.cxf.post.empty") != null) {
+                return;
+            }
             
             // If we need to cache for retransmission, store data in a
             // CacheAndWriteOutputStream. Otherwise write directly to the output stream.

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=835633&r1=835632&r2=835633&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 Thu
Nov 12 23:17:41 2009
@@ -96,6 +96,12 @@
         System.out.println("PreDestroy called");
     }
     
+    @POST
+    @Path("emptypost")
+    public void emptypost() {
+        System.out.println("empty post");
+    }
+    
     @GET
     @Path("webappexception")
     public Book throwException() {

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=835633&r1=835632&r2=835633&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
Thu Nov 12 23:17:41 2009
@@ -55,7 +55,7 @@
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue("server did not launch correctly",
-                   launchServer(BookServer.class, true));
+                   launchServer(BookServer.class));
     }
     
     
@@ -207,6 +207,14 @@
     }
     
     @Test
+    public void testEmptyPost() throws Exception {
+        WebClient wc = 
+            WebClient.create("http://localhost:9080/bookstore/emptypost");
+        Response response = wc.post(null);
+        assertEquals(204, response.getStatus());
+    }
+    
+    @Test
     public void testGetBookByEncodedQuery() throws Exception {
         getAndCompareAsStrings("http://localhost:9080/bookstore/bookquery?"
                                + "urlid=http%3A%2F%2Ftest.com%2Frss%2F123",



Mime
View raw message