Author: cmueller Date: Tue Dec 4 22:25:40 2012 New Revision: 1417223 URL: http://svn.apache.org/viewvc?rev=1417223&view=rev Log: CAMEL-5575 added "headerFilterStrategy" option on camel-http4
Modified: camel/branches/camel-2.10.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java camel/branches/camel-2.10.x/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointOptionsNotChangeComponentTest.java Modified: camel/branches/camel-2.10.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java?rev=1417223&r1=1417222&r2=1417223&view=diff ============================================================================== --- camel/branches/camel-2.10.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java (original) +++ camel/branches/camel-2.10.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java Tue Dec 4 22:25:40 2012 @@ -24,6 +24,7 @@ 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.spi.HeaderFilterStrategy; import org.apache.camel.util.IntrospectionSupport; import org.apache.camel.util.URISupport; import org.apache.camel.util.jsse.SSLContextParameters; @@ -194,6 +195,8 @@ public class HttpComponent extends Heade sslContextParameters = getSslContextParameters(); } + HeaderFilterStrategy headerFilterStrategy = resolveAndRemoveReferenceParameter(parameters, "headerFilterStrategy", HeaderFilterStrategy.class); + boolean secure = HttpHelper.isSecureConnection(uri); // create the configurer to use for this endpoint @@ -225,7 +228,11 @@ public class HttpComponent extends Heade } } endpoint.setHttpUri(httpUri); - setEndpointHeaderFilterStrategy(endpoint); + if (headerFilterStrategy != null) { + endpoint.setHeaderFilterStrategy(headerFilterStrategy); + } else { + setEndpointHeaderFilterStrategy(endpoint); + } endpoint.setBinding(getHttpBinding()); if (httpBinding != null) { endpoint.setHttpBinding(httpBinding); Modified: camel/branches/camel-2.10.x/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointOptionsNotChangeComponentTest.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointOptionsNotChangeComponentTest.java?rev=1417223&r1=1417222&r2=1417223&view=diff ============================================================================== --- camel/branches/camel-2.10.x/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointOptionsNotChangeComponentTest.java (original) +++ camel/branches/camel-2.10.x/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointOptionsNotChangeComponentTest.java Tue Dec 4 22:25:40 2012 @@ -49,6 +49,7 @@ public class HttpEndpointOptionsNotChang protected JndiRegistry createRegistry() throws Exception { JndiRegistry jndi = super.createRegistry(); jndi.bind("other", new MyOtherBinding()); + jndi.bind("myStrategy", new MyHeaderFilterStrategy()); return jndi; } @@ -65,6 +66,10 @@ public class HttpEndpointOptionsNotChang // and the default option has not been messed with HttpEndpoint end3 = context.getEndpoint("http4://www.google.com", HttpEndpoint.class); assertIsInstanceOf(MyBinding.class, end3.getBinding()); + + // test the headerFilterStrategy + HttpEndpoint end4 = context.getEndpoint("http4://www.google.com?headerFilterStrategy=#myStrategy", HttpEndpoint.class); + assertIsInstanceOf(MyHeaderFilterStrategy.class, end4.getHeaderFilterStrategy()); } @SuppressWarnings("deprecation") @@ -74,4 +79,8 @@ public class HttpEndpointOptionsNotChang @SuppressWarnings("deprecation") private static class MyOtherBinding extends DefaultHttpBinding { } + + private static class MyHeaderFilterStrategy extends HttpHeaderFilterStrategy { + } + }