You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ay...@apache.org on 2012/03/16 16:31:25 UTC

svn commit: r1301597 - in /cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java systests/jaxws/src/test/java/org/apache/cxf/systest/provider/InterpretNullAsOnewayProviderTest.java

Author: ay
Date: Fri Mar 16 15:31:24 2012
New Revision: 1301597

URL: http://svn.apache.org/viewvc?rev=1301597&view=rev
Log:
[CXF-4182] make jaxws.provider.interpretNullAsOneway prop configurable using a string

Modified:
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/InterpretNullAsOnewayProviderTest.java

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java?rev=1301597&r1=1301596&r2=1301597&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java Fri Mar 16 15:31:24 2012
@@ -32,6 +32,7 @@ import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.jaxws.context.WebServiceContextImpl;
 import org.apache.cxf.jaxws.context.WrappedMessageContext;
 import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.service.invoker.Factory;
 import org.apache.cxf.service.invoker.SingletonFactory;
 
@@ -62,7 +63,7 @@ public class JAXWSMethodInvoker extends 
             }
             res = CastUtils.cast((List<?>)super.invoke(exchange, serviceObject, m, params));
             if ((serviceObject instanceof Provider) 
-                && Boolean.TRUE.equals(exchange.getInMessage().
+                && MessageUtils.isTrue(exchange.getInMessage().
                                        getContextualProperty("jaxws.provider.interpretNullAsOneway"))
                 && (res != null && !res.isEmpty() && res.get(0) == null)) {
                 // treat the non-oneway call as oneway when a provider returns null

Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/InterpretNullAsOnewayProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/InterpretNullAsOnewayProviderTest.java?rev=1301597&r1=1301596&r2=1301597&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/InterpretNullAsOnewayProviderTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/InterpretNullAsOnewayProviderTest.java Fri Mar 16 15:31:24 2012
@@ -43,6 +43,7 @@ public class InterpretNullAsOnewayProvid
 
     private static final String ADDRESS1 = "http://localhost:" + PORT + "/test/nullable1";
     private static final String ADDRESS2 = "http://localhost:" + PORT + "/test/nullable2";
+    private static final String ADDRESS3 = "http://localhost:" + PORT + "/test/nullable3";
     
     public static class Server extends AbstractBusTestServerBase {
     
@@ -57,6 +58,12 @@ public class InterpretNullAsOnewayProvid
             Endpoint ep2 = Endpoint.publish(ADDRESS2, servant2);
             assertNotNull("endpoint published", ep2);
             ep2.getProperties().put("jaxws.provider.interpretNullAsOneway", Boolean.TRUE);
+
+            // endpoint interpreting null as oneway
+            NullProviderService servant3 = new NullProviderService();
+            Endpoint ep3 = Endpoint.publish(ADDRESS3, servant3);
+            assertNotNull("endpoint published", ep3);
+            ep3.getProperties().put("jaxws.provider.interpretNullAsOneway", "true");
         }
     
         public static void main(String[] args) throws Exception { 
@@ -97,6 +104,12 @@ public class InterpretNullAsOnewayProvid
         HttpURLConnection conn = postRequest(ADDRESS2);
         assertEquals("http 202 must be returned", 202, conn.getResponseCode());
     }
+
+    @Test
+    public void testInterpretNullAsOneway2() throws Exception {
+        HttpURLConnection conn = postRequest(ADDRESS3);
+        assertEquals("http 202 must be returned", 202, conn.getResponseCode());
+    }
     
     private static HttpURLConnection postRequest(String address) throws Exception {
         URL url = new URL(address);