Author: slewis Date: Thu Mar 18 15:08:15 2010 New Revision: 924849 URL: http://svn.apache.org/viewvc?rev=924849&view=rev Log: CAMEL-2559 - HttpComponent only checks the registry for an HttpClientConfigurer, setHttpClientConfigurer no longer works.
Added: camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpClientConfigurerTest.java (with props) Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java?rev=924849&r1=924848&r2=924849&view=diff ============================================================================== --- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java (original) +++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java Thu Mar 18 15:08:15 2010 @@ -89,12 +89,16 @@ public class HttpComponent extends Heade */ protected void configureParameters(Map<String, Object> parameters) { // lookup http binding in registry if provided - httpBinding = resolveAndRemoveReferenceParameter( - parameters, "httpBindingRef", HttpBinding.class); + if ( httpBinding == null ) { + httpBinding = resolveAndRemoveReferenceParameter( + parameters, "httpBindingRef", HttpBinding.class); + } // lookup http client front configurer in the registry if provided - httpClientConfigurer = resolveAndRemoveReferenceParameter( - parameters, "httpClientConfigurerRef", HttpClientConfigurer.class); + if ( httpClientConfigurer == null ) { + httpClientConfigurer = resolveAndRemoveReferenceParameter( + parameters, "httpClientConfigurerRef", HttpClientConfigurer.class); + } // check the user name and password for basic authentication String username = getAndRemoveParameter(parameters, "username", String.class); @@ -293,4 +297,4 @@ public class HttpComponent extends Heade } super.stop(); } -} \ No newline at end of file +} Added: camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpClientConfigurerTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpClientConfigurerTest.java?rev=924849&view=auto ============================================================================== --- camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpClientConfigurerTest.java (added) +++ camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpClientConfigurerTest.java Thu Mar 18 15:08:15 2010 @@ -0,0 +1,58 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.http; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Ignore; +import org.junit.Test; + +/** + * @version $Revision: 905992 $ + */ +public class HttpClientConfigurerTest extends CamelTestSupport { + protected String expectedText = "activemq"; + + @Test + public void testHttpClientConfigurer() throws Exception { + HttpClientConfigurer configurer = getMandatoryEndpoint("http://www.google.com/search", HttpEndpoint.class).getHttpClientConfigurer(); + + assertNotNull("Client configurer should not be null!", configurer); + + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + public void configure() { + + ProxyHttpClientConfigurer configurer = new ProxyHttpClientConfigurer( + "proxyhost", + 80, + "user", + "password", + null, + null); + + getContext().getComponent("http", HttpComponent.class).setHttpClientConfigurer(configurer); + + from("direct:start") + .to("http://www.google.com/search"); + } + }; + } +} Propchange: camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpClientConfigurerTest.java ------------------------------------------------------------------------------ svn:eol-style = native