cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r732450 - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/staxutils/ etc/eclipse/ rt/transports/http/src/main/java/org/apache/cxf/transport/http/ rt/transports/http/src/main/java/org/apache/cxf/transport/https/ systests/src/test/j...
Date Wed, 07 Jan 2009 19:59:16 GMT
Author: dkulp
Date: Wed Jan  7 11:59:15 2009
New Revision: 732450

URL: http://svn.apache.org/viewvc?rev=732450&view=rev
Log:
Fix problem of using ENDPOINT_ADDRESS setting to change from https to http

Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
    cxf/trunk/etc/eclipse/template.checkstyle-config.xml
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpURLConnectionFactory.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpURLConnectionFactoryImpl.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/BusServer.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/jaxws-server.xml
    cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractTestServerBase.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java?rev=732450&r1=732449&r2=732450&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
(original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
Wed Jan  7 11:59:15 2009
@@ -270,7 +270,13 @@
         if (attr.isId()) {
             return "ID";
         }
-        TypeInfo schemaType = attr.getSchemaTypeInfo();
+        TypeInfo schemaType = null;
+        try {
+            schemaType = attr.getSchemaTypeInfo();
+        } catch (Throwable t) {
+            //DOM level 2?
+            schemaType = null;
+        }
         return (schemaType == null) ? "CDATA" 
             : schemaType.getTypeName() == null ? "CDATA" : schemaType.getTypeName();
     }

Modified: cxf/trunk/etc/eclipse/template.checkstyle-config.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/etc/eclipse/template.checkstyle-config.xml?rev=732450&r1=732449&r2=732450&view=diff
==============================================================================
--- cxf/trunk/etc/eclipse/template.checkstyle-config.xml (original)
+++ cxf/trunk/etc/eclipse/template.checkstyle-config.xml Wed Jan  7 11:59:15 2009
@@ -18,10 +18,6 @@
   under the License.
 -->
 <checkstyle-configurations file-format-version="5.0.0">
-    <check-configuration name="CXF Checks" location="@CHECKSTYLE_CONFIG_FILE@" type="external"
description="">
-        <property name="apache.header.file" value="@APACHE_HEADER_FILE@"/>
-    </check-configuration>
-    <check-configuration name="CXF CORBA Checks" location="@CHECKSTYLE_CORBA_CONFIG_FILE@"
type="external" description="">
-        <property name="apache.header.file" value="@APACHE_HEADER_FILE@"/>
-    </check-configuration>
+    <check-configuration name="CXF Checks" location="@CHECKSTYLE_CONFIG_FILE@" type="external"
description=""/>
+    <check-configuration name="CXF CORBA Checks" location="@CHECKSTYLE_CORBA_CONFIG_FILE@"
type="external" description=""/>
 </checkstyle-configurations>
\ No newline at end of file

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java?rev=732450&r1=732449&r2=732450&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
Wed Jan  7 11:59:15 2009
@@ -237,14 +237,21 @@
      * This static call creates a connection factory based on
      * the existence of the SSL (TLS) client side configuration. 
      */
+    static HttpURLConnectionFactory getConnectionFactory(HTTPConduit configuredConduit) {
+        return getConnectionFactory(configuredConduit, null);
+    }
+    
     static HttpURLConnectionFactory getConnectionFactory(
-        HTTPConduit configuredConduit
+        HTTPConduit configuredConduit,
+        String address
     ) {
         HttpURLConnectionFactory fac = null;
         boolean useHttps = false;
 
         try {
-            String address = configuredConduit.getAddress();
+            if (address == null) {
+                address = configuredConduit.getAddress();
+            }
             if (address != null 
                 && address.startsWith(HttpsURLConnectionFactory.HTTPS_URL_PROTOCOL_ID
+ ":/")) {
                 useHttps = true;
@@ -252,9 +259,7 @@
         } catch (MalformedURLException e) {
             //ignore, just use info based on Tls
         }
-        if (useHttps 
-            || configuredConduit.getTlsClientParameters() != null) {
-            
+        if (useHttps) {
             TLSClientParameters params = configuredConduit.getTlsClientParameters();
             if (params == null) {
                 params = new TLSClientParameters(); //use defaults

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=732450&r1=732449&r2=732450&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
Wed Jan  7 11:59:15 2009
@@ -444,6 +444,9 @@
     protected void retrieveConnectionFactory() {
         connectionFactory = AbstractHTTPTransportFactory.getConnectionFactory(this);
     }
+    protected void retrieveConnectionFactory(String url) {
+        connectionFactory = AbstractHTTPTransportFactory.getConnectionFactory(this, url);
+    }
     
     /**
      * Prepare to send an outbound HTTP message over this http conduit to a 
@@ -686,6 +689,16 @@
             }
             result = getURL().toString();
             message.put(Message.ENDPOINT_ADDRESS, result);
+        } else {
+            if (connectionFactory == null 
+                || result.startsWith(connectionFactory.getProtocol() + ":/")) {
+            
+                connectionFactory = null;
+                if (!result.startsWith("https:/")) {
+                    tlsClientParameters = null;
+                }
+                retrieveConnectionFactory(result);
+            }
         }
         
         // REVISIT: is this really correct?

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpURLConnectionFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpURLConnectionFactory.java?rev=732450&r1=732449&r2=732450&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpURLConnectionFactory.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpURLConnectionFactory.java
Wed Jan  7 11:59:15 2009
@@ -51,4 +51,9 @@
     HttpURLConnectionInfo getConnectionInfo(
             HttpURLConnection connnection
     ) throws IOException;
+    
+    /**
+     * @return the protocol that this connection supports (http or https)
+     */
+    String getProtocol();
 }

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpURLConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpURLConnectionFactoryImpl.java?rev=732450&r1=732449&r2=732450&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpURLConnectionFactoryImpl.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpURLConnectionFactoryImpl.java
Wed Jan  7 11:59:15 2009
@@ -63,4 +63,8 @@
         // to represent for an HttpURLConnection.
         return new HttpURLConnectionInfo(connection);
     }
+
+    public String getProtocol() {
+        return "http";
+    }
 }

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java?rev=732450&r1=732449&r2=732450&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java
Wed Jan  7 11:59:15 2009
@@ -223,6 +223,11 @@
     ) throws IOException {  
         return new HttpsURLConnectionInfo((HttpsURLConnection)connection);
     }
+    
+    public String getProtocol() {
+        return "https";
+    }
+
 }
 
 

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/BusServer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/BusServer.java?rev=732450&r1=732449&r2=732450&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/BusServer.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/BusServer.java Wed Jan  7
11:59:15 2009
@@ -29,19 +29,18 @@
  */
 public class BusServer extends AbstractBusTestServerBase {
 
-
     protected void run()  {
         //
         // Just instantiate the Bus; services will be instantiated
         // and published automatically through Spring
         //
         final BusFactory factory = BusFactory.newInstance();
-        final Bus bus = factory.createBus();
+        Bus bus = factory.createBus();
+        setBus(bus);
         BusFactory.setDefaultBus(bus);
         BusFactory.setThreadDefaultBus(bus);
     }
 
-
     public static void main(String[] args) {
         try {
             BusServer s = new BusServer();

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java?rev=732450&r1=732449&r2=732450&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java Wed
Jan  7 11:59:15 2009
@@ -108,7 +108,11 @@
         testSuccessfulCall("resources/jaxws-server.xml", 
                            "https://localhost:9002/SoapContext/HttpsPort");        
     }
-    
+    @Test
+    public final void testJaxwsServerChangeHttpsToHttp() throws Exception {
+        testSuccessfulCall("resources/jaxws-server.xml", 
+                            "http://localhost:9003/SoapContext/HttpPort");        
+    }    
     @Test
     public final void testJaxwsEndpoint() throws Exception {
         testSuccessfulCall("resources/jaxws-publish.xml",

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/jaxws-server.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/jaxws-server.xml?rev=732450&r1=732449&r2=732450&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/jaxws-server.xml
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/jaxws-server.xml
Wed Jan  7 11:59:15 2009
@@ -56,7 +56,20 @@
         <jaxws:serviceBean>
            <bean class="org.apache.cxf.systest.http.GreeterImpl"/>
         </jaxws:serviceBean>
-    </jaxws:server>    
+    </jaxws:server>   
+    
+    <!--  Non http endpoint -->
+    <jaxws:server 
+        id="JaxwsHttpEndpoint"        
+        address="http://localhost:9003/SoapContext/HttpPort"
+        serviceName="s:SOAPService"
+        endpointName="e:HttpsPort"
+        xmlns:e="http://apache.org/hello_world/services"
+        xmlns:s="http://apache.org/hello_world/services">
+        <jaxws:serviceBean>
+           <bean class="org.apache.cxf.systest.http.GreeterImpl"/>
+        </jaxws:serviceBean>
+    </jaxws:server> 
 
     <!-- -->
     <!-- TLS Port configuration parameters for port 9002 -->

Modified: cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractTestServerBase.java
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractTestServerBase.java?rev=732450&r1=732449&r2=732450&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractTestServerBase.java
(original)
+++ cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractTestServerBase.java
Wed Jan  7 11:59:15 2009
@@ -51,6 +51,7 @@
     
     public boolean stopInProcess() throws Exception {
         boolean ret = true;
+        tearDown();
         if (verify(getLog())) {
             if (!inProcess) {
                 System.out.println("server passed");



Mime
View raw message