camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1144310 - in /camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4: HttpComponent.java HttpEndpoint.java helper/HttpHelper.java
Date Fri, 08 Jul 2011 13:32:31 GMT
Author: davsclaus
Date: Fri Jul  8 13:32:30 2011
New Revision: 1144310

URL: http://svn.apache.org/viewvc?rev=1144310&view=rev
Log:
CAMEL-4176: Fixed fallback to use http4 or http4s for proxy scheme when configured as property
on CamelContext properties.

Modified:
    camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
    camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
    camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java

Modified: camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java?rev=1144310&r1=1144309&r2=1144310&view=diff
==============================================================================
--- camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
(original)
+++ camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
Fri Jul  8 13:32:30 2011
@@ -22,6 +22,7 @@ import java.util.Map;
 
 import org.apache.camel.Endpoint;
 import org.apache.camel.ResolveEndpointFailedException;
+import org.apache.camel.component.http4.helper.HttpHelper;
 import org.apache.camel.impl.HeaderFilterStrategyComponent;
 import org.apache.camel.util.CastUtils;
 import org.apache.camel.util.IntrospectionSupport;
@@ -182,7 +183,7 @@ public class HttpComponent extends Heade
             sslContextParameters = this.sslContextParameters;
         }
         
-        boolean secure = isSecureConnection(uri);
+        boolean secure = HttpHelper.isSecureConnection(uri);
 
         // create the configurer to use for this endpoint
         HttpClientConfigurer configurer = createHttpClientConfigurer(parameters, secure);
@@ -301,10 +302,6 @@ public class HttpComponent extends Heade
         return clientParams;
     }
 
-    private boolean isSecureConnection(String uri) {
-        return uri.startsWith("https");
-    }
-
     @Override
     protected boolean useIntrospectionOnEndpoint() {
         return false;

Modified: camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java?rev=1144310&r1=1144309&r2=1144310&view=diff
==============================================================================
--- camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
(original)
+++ camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
Fri Jul  8 13:32:30 2011
@@ -21,6 +21,7 @@ import java.net.URISyntaxException;
 
 import org.apache.camel.PollingConsumer;
 import org.apache.camel.Producer;
+import org.apache.camel.component.http4.helper.HttpHelper;
 import org.apache.camel.impl.DefaultPollingEndpoint;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.spi.HeaderFilterStrategyAware;
@@ -117,6 +118,10 @@ public class HttpEndpoint extends Defaul
             String host = getCamelContext().getProperties().get("http.proxyHost");
             int port = Integer.parseInt(getCamelContext().getProperties().get("http.proxyPort"));
             String scheme = getCamelContext().getProperties().get("http.proxyScheme");
+            // fallback and use either http4 or https4 depending on secure
+            if (scheme == null) {
+                scheme = HttpHelper.isSecureConnection(getEndpointUri()) ? "https4" : "http4";
+            }
 
             LOG.debug("CamelContext properties http.proxyHost, http.proxyPort, and http.proxyScheme
detected. Using http proxy host: {} port: {} scheme: {}", new Object[]{host, port, scheme});
             HttpHost proxy = new HttpHost(host, port, scheme);

Modified: camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java?rev=1144310&r1=1144309&r2=1144310&view=diff
==============================================================================
--- camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java
(original)
+++ camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java
Fri Jul  8 13:32:30 2011
@@ -265,6 +265,10 @@ public final class HttpHelper {
             throw new ProtocolException("Invalid HTTP minor version number: " + s);
         }
         return new HttpVersion(major, minor);
+    }
 
+    public static boolean isSecureConnection(String uri) {
+        return uri.startsWith("https");
     }
+
 }



Mime
View raw message