cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1164536 - in /cxf/trunk/rt/transports/http/src: main/java/org/apache/cxf/transport/http/HTTPConduit.java test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
Date Fri, 02 Sep 2011 13:55:59 GMT
Author: ay
Date: Fri Sep  2 13:55:58 2011
New Revision: 1164536

URL: http://svn.apache.org/viewvc?rev=1164536&view=rev
Log:
[CXF-3788] Allow CXF HTTP Client to handle HTTP 202 for twoway calls when the real response
is sent back to the decoupled endpoint

Modified:
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.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=1164536&r1=1164535&r2=1164536&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
Fri Sep  2 13:55:58 2011
@@ -1545,7 +1545,8 @@ public class HTTPConduit 
             }
 
             InputStream in = null;
-            if (isOneway(exchange)) {
+            // oneway or decoupled twoway calls may expect HTTP 202 with no content
+            if (isOneway(exchange) || HttpURLConnection.HTTP_ACCEPTED == responseCode) {
                 in = ChunkedUtil.getPartialResponse(connection, responseCode);
                 if (in == null) {
                     // oneway operation or decoupled MEP without 

Modified: cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java?rev=1164536&r1=1164535&r2=1164536&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
(original)
+++ cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
Fri Sep  2 13:55:58 2011
@@ -208,6 +208,22 @@ public class HTTPConduitURLEasyMockTest 
         finalVerify();
     }
     
+    @Test
+    public void testSendTwowayDecoupledEmptyPartialResponse() 
+        throws Exception {
+        control = EasyMock.createNiceControl();
+        HTTPConduit conduit = setUpConduit(true, false);
+        Message message = new MessageImpl();
+        conduit.prepare(message);
+        verifySentMessage(conduit, 
+                          message, 
+                          ResponseStyle.DECOUPLED,
+                          ResponseDelimiter.EOF,
+                          true,  // empty response
+                          "POST");
+        finalVerify();
+    }
+
     private void setUpHeaders(Message message) {
         Map<String, List<String>> headers = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
         List<String> contentTypes = new ArrayList<String>();



Mime
View raw message