cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1003251 - in /cxf/trunk/rt: transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/ transports/http/src/main/java/org/apache/cxf/transport/http/ ws/addr/src/main/java/org/apache/cxf/ws/addressing/ ws/rm/src/main/java/org/a...
Date Thu, 30 Sep 2010 20:49:35 GMT
Author: dkulp
Date: Thu Sep 30 20:49:34 2010
New Revision: 1003251

URL: http://svn.apache.org/viewvc?rev=1003251&view=rev
Log:
[CXF-3004] Make sure the response codes for ws-add and ws-rm things are correct

Modified:
    cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java

Modified: cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java?rev=1003251&r1=1003250&r2=1003251&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
(original)
+++ cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
Thu Sep 30 20:49:34 2010
@@ -410,9 +410,6 @@ public class JettyHTTPDestinationTest ex
         Conduit partialBackChannel =
             destination.getBackChannel(inMessage, partialResponse, replyTo);
         partialBackChannel.prepare(partialResponse);
-        assertEquals("unexpected response code",
-                     202,
-                     partialResponse.get(Message.RESPONSE_CODE));
         verifyBackChannelSend(partialBackChannel, partialResponse, 202);
 
         outMessage = setUpOutMessage();

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=1003251&r1=1003250&r2=1003251&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
Thu Sep 30 20:49:34 2010
@@ -180,9 +180,6 @@ public abstract class AbstractHTTPDestin
     }
     
     protected void updateResponseHeaders(Message message) {
-        if (MessageUtils.isPartialResponse(message)) {
-            message.put(Message.RESPONSE_CODE, HttpURLConnection.HTTP_ACCEPTED);
-        }
         Map<String, List<String>> responseHeaders =
             CastUtils.cast((Map)message.get(Message.PROTOCOL_HEADERS));
         if (responseHeaders == null) {
@@ -540,7 +537,7 @@ public abstract class AbstractHTTPDestin
                     }
                 }
                 response.setStatus(status);
-            } else if (oneWay) {
+            } else if (oneWay && !MessageUtils.isPartialResponse(outMessage)) {
                 response.setStatus(HttpURLConnection.HTTP_ACCEPTED);
             } else {
                 response.setStatus(HttpURLConnection.HTTP_OK);
@@ -548,7 +545,6 @@ public abstract class AbstractHTTPDestin
 
             copyResponseHeaders(outMessage, response);
 
-            
             if (oneWay && !MessageUtils.isPartialResponse(outMessage)) {
                 response.setContentLength(0);
                 response.flushBuffer();
@@ -598,9 +594,6 @@ public abstract class AbstractHTTPDestin
          * @param message the message to be sent.
          */
         public void prepare(Message message) throws IOException {
-            if (MessageUtils.isPartialResponse(message)) {
-                message.put(Message.RESPONSE_CODE, HttpURLConnection.HTTP_ACCEPTED);
-            }
             message.put(HTTP_RESPONSE, response);
             OutputStream os = message.getContent(OutputStream.class);
             if (os == null) {

Modified: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java?rev=1003251&r1=1003250&r2=1003251&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java Thu
Sep 30 20:49:34 2010
@@ -1000,6 +1000,7 @@ public class MAPAggregator extends Abstr
             //inMessage.remove(AbstractHTTPDestination.HTTP_REQUEST);
             //inMessage.remove(AbstractHTTPDestination.HTTP_RESPONSE);
             inMessage.remove(Message.ASYNC_POST_RESPONSE_DISPATCH);
+            updateResponseCode(inMessage);
 
             //cache this inputstream since it's defer to use in case of async
             try {
@@ -1014,6 +1015,20 @@ public class MAPAggregator extends Abstr
                 e.printStackTrace();
             }
         }
+        
+        private void updateResponseCode(Message message) {
+            Object o = message.get("HTTP.RESPONSE");
+            if (o != null) {
+                try {
+                    o.getClass().getMethod("setStatus", Integer.TYPE)
+                        .invoke(o, HttpURLConnection.HTTP_ACCEPTED);
+                } catch (Throwable t) {
+                    //ignore
+                }
+            }
+            
+        }
+        
     }
     
     /**

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java?rev=1003251&r1=1003250&r2=1003251&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java Thu
Sep 30 20:49:34 2010
@@ -20,6 +20,7 @@
 package org.apache.cxf.ws.rm.soap;
 
 
+import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -220,6 +221,10 @@ public class RMSoapInterceptor extends A
                 }
             }
             Node node = hdr.getFirstChild();
+            if (node != null && MessageUtils.isPartialResponse(message)) {
+                // make sure the response is returned as HTTP 200 and not 202
+                message.put(Message.RESPONSE_CODE, HttpURLConnection.HTTP_OK);
+            }
             while (node != null) {
                 Header holder = new Header(new QName(node.getNamespaceURI(), node.getLocalName()),
node);
                 header.add(holder);



Mime
View raw message