cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1026341 - in /cxf/trunk: rt/core/src/main/java/org/apache/cxf/interceptor/ rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ systests/transports/src/test/java/org/apache/cxf/systest/servlet/
Date Fri, 22 Oct 2010 14:32:21 GMT
Author: dkulp
Date: Fri Oct 22 14:32:21 2010
New Revision: 1026341

URL: http://svn.apache.org/viewvc?rev=1026341&view=rev
Log:
[CXF-3082] Make EndpointImpl.publish() work correctly without throwing
the NPE on the get of the service list and wsdl

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletClientTest.java
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java?rev=1026341&r1=1026340&r2=1026341&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java
Fri Oct 22 14:32:21 2010
@@ -337,13 +337,12 @@ public class URIMappingInterceptor exten
         return queries;
     }
     
-    private String getBasePath(Message message) {
-        return (String)message.get(Message.BASE_PATH);        
-    }
-    
     private String getRest(Message message) {
         String path = (String)message.get(Message.PATH_INFO);
-        String basePath = getBasePath(message);        
+        String basePath = (String)message.get(Message.BASE_PATH);
+        if (basePath == null) {
+            basePath = "/";
+        }
         return StringUtils.diff(path, basePath);        
     }
     

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?rev=1026341&r1=1026340&r2=1026341&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
Fri Oct 22 14:32:21 2010
@@ -93,6 +93,9 @@ public class ServletController extends A
                 && d2.getAddress() != null
                 && d2.getAddress().getAddress() != null) {
                 ad = d2.getAddress().getAddress().getValue();
+                if (ad == null) {
+                    ad = "/";
+                }
             }
             if (ad != null 
                 && (ad.equals(path)

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java?rev=1026341&r1=1026340&r2=1026341&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
Fri Oct 22 14:32:21 2010
@@ -100,6 +100,9 @@ public class ServletDestination extends 
     protected String getBasePath(String contextPath) throws IOException {
         
         String address = getAddress().getAddress().getValue();
+        if (address == null) {
+            return contextPath;
+        }
         if (address.startsWith("http")) {
             return URI.create(address).getPath();
         }

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletClientTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletClientTest.java?rev=1026341&r1=1026340&r2=1026341&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletClientTest.java
(original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletClientTest.java
Fri Oct 22 14:32:21 2010
@@ -20,6 +20,9 @@ package org.apache.cxf.systest.servlet;
 
 import java.lang.reflect.UndeclaredThrowableException;
 import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
 import javax.xml.namespace.QName;
 
 import com.meterware.httpunit.WebConversation;
@@ -75,10 +78,16 @@ public class NoSpringServletClientTest e
     @Test
     public void testGetServiceList() throws Exception {
         WebConversation client = new WebConversation();
-        WebResponse res = client.getResponse(serviceURL);
+        WebResponse res = client.getResponse(serviceURL + "/services");
         WebLink[] links = res.getLinks();
-        assertEquals("There should get two links for the service", 2, links.length);
-        assertEquals(serviceURL + "Greeter?wsdl", links[0].getURLString());
+        Set<String> s = new HashSet<String>();
+        for (WebLink l : links) {
+            s.add(l.getURLString());
+        }
+        assertEquals("There should be 3 links for the service", 3, links.length);
+        assertTrue(s.contains(serviceURL + "Greeter?wsdl"));
+        assertTrue(s.contains(serviceURL + "Hello?wsdl"));
+        assertTrue(s.contains(serviceURL + "?wsdl"));
         assertEquals("text/html", res.getContentType());
     }
 }

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java?rev=1026341&r1=1026340&r2=1026341&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java
(original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java
Fri Oct 22 14:32:21 2010
@@ -22,6 +22,7 @@ import javax.xml.ws.Endpoint;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
+import org.apache.cxf.jaxws.EndpointImpl;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
 import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
 import org.apache.hello_world_soap_http.GreeterImpl;
@@ -63,6 +64,8 @@ public class NoSpringServletServer exten
             Endpoint.publish("/Greeter", impl);
             HelloImpl helloImpl = new HelloImpl();
             Endpoint.publish("/Hello", helloImpl);
+            
+            ((EndpointImpl)Endpoint.create(helloImpl)).publish();
 
         } catch (Exception e) {
             throw new RuntimeException(e);



Mime
View raw message