Hello
I'm sending a patch in attachment for usage of https/http with the same
HttpConduit, once https is configured. It should be considered only an interim
patch until CXF developers implement a better solution.
Jaro
diff -ru old/HTTPConduit.java new/HTTPConduit.java
--- old/HTTPConduit.java Sat Oct 18 18:41:22 2008
+++ new/HTTPConduit.java Wed Jan 14 21:39:38 2009
@@ -180,6 +180,12 @@
* Factory.
*/
protected HttpURLConnectionFactory connectionFactory;
+
+ /**
+ * This factory is only used for HTTP connections, and not HTTPS.
+ * That allows us to use both HTTPS and HTTP, once HTTPS is configured.
+ */
+ private HttpURLConnectionFactory httpConnectionFactory;
/**
* This field holds a reference to the CXF bus associated this conduit.
@@ -443,6 +449,15 @@
*/
protected void retrieveConnectionFactory() {
connectionFactory =
AbstractHTTPTransportFactory.getConnectionFactory(this);
+ if (!(connectionFactory instanceof HttpURLConnectionFactoryImpl))
+ {
+ // if default connection factory is not HTTP, then create 2nd which
is
+ httpConnectionFactory = new HttpURLConnectionFactoryImpl();
+ }
+ else
+ {
+ httpConnectionFactory = null;
+ }
}
/**
@@ -478,9 +493,19 @@
// The need to cache the request is off by default
boolean needToCacheRequest = false;
+
+ HttpURLConnectionFactory localConnectionfactory = connectionFactory;
+ if ("http".equalsIgnoreCase(currentURL.getProtocol()) &&
+ !(localConnectionfactory instanceof HttpURLConnectionFactoryImpl))
+ {
+ if (httpConnectionFactory != null)
+ {
+ localConnectionfactory = httpConnectionFactory;
+ }
+ }
HttpURLConnection connection =
- connectionFactory.createConnection(
+ localConnectionfactory.createConnection(
getProxy(clientSidePolicy), currentURL);
connection.setDoOutput(true);