cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r503973 - in /incubator/cxf/trunk: rt/transports/http/src/main/java/org/apache/cxf/transport/http/ systests/src/test/java/org/apache/cxf/systest/jaxws/
Date Tue, 06 Feb 2007 04:14:17 GMT
Author: ningjiang
Date: Mon Feb  5 20:14:16 2007
New Revision: 503973

URL: http://svn.apache.org/viewvc?view=rev&rev=503973
Log:
Fixed the ?wsdl error, and added a simple systest for it.

Modified:
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java?view=diff&rev=503973&r1=503972&r2=503973
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java
Mon Feb  5 20:14:16 2007
@@ -51,7 +51,6 @@
 import org.apache.cxf.transport.DestinationFactoryManager;
 import org.apache.cxf.transport.https.HttpsURLConnectionFactory;
 import org.apache.cxf.transport.https.JettySslListenerFactory;
-import org.apache.cxf.transports.http.QueryHandlerRegistry;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.wsdl11.WSDLEndpointFactory;
 import org.mortbay.http.SocketListener;
@@ -102,10 +101,10 @@
             }
         }
         
-        QueryHandlerRegistry qhr = bus.getExtension(QueryHandlerRegistry.class);
+        /*QueryHandlerRegistry qhr = bus.getExtension(QueryHandlerRegistry.class);
         if (null != qhr) {
             qhr.registerHandler(new WSDLQueryHandler());
-        }
+        }*/
     }
 
     public Conduit getConduit(EndpointInfo endpointInfo) throws IOException {

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java?view=diff&rev=503973&r1=503972&r2=503973
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
Mon Feb  5 20:14:16 2007
@@ -35,10 +35,18 @@
     Bus bus;
     
     @PostConstruct
+    public void register() {
+        if (null != bus) {
+            bus.setExtension(this, QueryHandlerRegistry.class);
+        }
+    }
+    
+    @PostConstruct
     public void init() {
         queryHandlers = new ArrayList<QueryHandler>();
-        bus.setExtension(this, QueryHandlerRegistry.class);
+        registerHandler(new WSDLQueryHandler());
     }
+
 
     public List<QueryHandler> getHandlers() {
         return queryHandlers;

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java?view=diff&rev=503973&r1=503972&r2=503973
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
Mon Feb  5 20:14:16 2007
@@ -33,16 +33,16 @@
 public class WSDLQueryHandler implements QueryHandler {
 
     public String getResponseContentType(String uri) {
-        if (uri.toString().toLowerCase().endsWith("?wsdl")) {
+        if (uri.toLowerCase().endsWith("?wsdl")) {
             return "text/xml";
         }
         return null;
     }
 
-    public boolean isRecognizedQuery(String uri, EndpointInfo endpointInfo) {       
-        if (uri != null) {
-            return endpointInfo.getAddress().contains(uri) 
-                && uri.toString().toLowerCase().endsWith("?wsdl");   
+    public boolean isRecognizedQuery(String uri, EndpointInfo endpointInfo) {
+        if (uri != null && uri.toLowerCase().endsWith("?wsdl")) {
+            String addressContext = uri.substring(0, uri.length() - 5);            
+            return endpointInfo.getAddress().contains(addressContext);
         }
         return false;
     }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?view=diff&rev=503973&r1=503972&r2=503973
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
Mon Feb  5 20:14:16 2007
@@ -166,7 +166,7 @@
             throw (Exception)ex.getCause();
         }
     }
-    
+        
     public void testBasicConnectionAndOneway() throws Exception {
         URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
         assertNotNull(wsdl);
@@ -582,6 +582,25 @@
                                                body, 
                                                XPathConstants.STRING);
         assertEquals("Hello cxf", response);
+    }
+    
+    public void testGetWSDL() throws Exception {
+        String url = "http://localhost:9000/SoapContext/SoapPort?wsdl";
+        HttpURLConnection httpConnection = getHttpConnection(url);    
+        httpConnection.connect();        
+        
+        assertEquals(200, httpConnection.getResponseCode());
+    
+        assertEquals("text/xml", httpConnection.getContentType());
+        assertEquals("OK", httpConnection.getResponseMessage());
+        
+        InputStream in = httpConnection.getInputStream();
+        assertNotNull(in);
+        
+        Document doc = XMLUtils.parse(in);
+        assertNotNull(doc);
+       
+                
     }
     
     public void testGetGreetMeFromQuery() throws Exception {



Mime
View raw message