You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/06/09 11:06:38 UTC
svn commit: r782923 - in /camel/trunk/components/camel-http/src:
main/java/org/apache/camel/component/http/HttpEndpoint.java
test/java/org/apache/camel/component/http/HttpProxyTest.java
Author: davsclaus
Date: Tue Jun 9 09:06:38 2009
New Revision: 782923
URL: http://svn.apache.org/viewvc?rev=782923&view=rev
Log:
CAMEL-1687: camel-http now uses http proxy settings from java system properties. Thanks to Savas for patch.
Modified:
camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyTest.java
Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java?rev=782923&r1=782922&r2=782923&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java (original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java Tue Jun 9 09:06:38 2009
@@ -93,11 +93,6 @@
ObjectHelper.notNull(httpConnectionManager, "httpConnectionManager");
HttpClient answer = new HttpClient(getClientParams());
- answer.setHttpConnectionManager(httpConnectionManager);
- HttpClientConfigurer configurer = getHttpClientConfigurer();
- if (configurer != null) {
- configurer.configureHttpClient(answer);
- }
// configure http proxy if defined as system property
// http://java.sun.com/javase/6/docs/technotes/guides/net/proxies.html
@@ -111,6 +106,11 @@
answer.getHostConfiguration().setProxy(host, port);
}
+ answer.setHttpConnectionManager(httpConnectionManager);
+ HttpClientConfigurer configurer = getHttpClientConfigurer();
+ if (configurer != null) {
+ configurer.configureHttpClient(answer);
+ }
return answer;
}
Modified: camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyTest.java?rev=782923&r1=782922&r2=782923&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyTest.java (original)
+++ camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyTest.java Tue Jun 9 09:06:38 2009
@@ -48,4 +48,20 @@
}
}
+ public void testHttpProxyEndpointConfigured() throws Exception {
+ HttpEndpoint http = context.getEndpoint("http://www.google.com?proxyHost=myotherproxy&proxyPort=2345", HttpEndpoint.class);
+
+ System.setProperty("http.proxyHost", "myproxy");
+ System.setProperty("http.proxyPort", "1234");
+
+ try {
+ HttpClient client = http.createHttpClient();
+ assertEquals("myotherproxy", client.getHostConfiguration().getProxyHost());
+ assertEquals(2345, client.getHostConfiguration().getProxyPort());
+ } finally {
+ System.clearProperty("http.proxyHost");
+ System.clearProperty("http.proxyPort");
+ }
+ }
+
}