You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by cm...@apache.org on 2012/12/04 23:29:55 UTC
svn commit: r1417225 - in
/camel/branches/camel-2.9.x/components/camel-http4/src:
main/java/org/apache/camel/component/http4/HttpComponent.java
test/java/org/apache/camel/component/http4/HttpEndpointOptionsNotChangeComponentTest.java
Author: cmueller
Date: Tue Dec 4 22:29:54 2012
New Revision: 1417225
URL: http://svn.apache.org/viewvc?rev=1417225&view=rev
Log:
CAMEL-5575 added "headerFilterStrategy" option on camel-http4
Modified:
camel/branches/camel-2.9.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
camel/branches/camel-2.9.x/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointOptionsNotChangeComponentTest.java
Modified: camel/branches/camel-2.9.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java?rev=1417225&r1=1417224&r2=1417225&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java (original)
+++ camel/branches/camel-2.9.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java Tue Dec 4 22:29:54 2012
@@ -25,6 +25,7 @@ import org.apache.camel.ResolveEndpointF
import org.apache.camel.component.http4.helper.HttpHelper;
import org.apache.camel.impl.HeaderFilterStrategyComponent;
import org.apache.camel.util.CastUtils;
+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;
@@ -195,6 +196,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
@@ -226,7 +229,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.9.x/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointOptionsNotChangeComponentTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointOptionsNotChangeComponentTest.java?rev=1417225&r1=1417224&r2=1417225&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointOptionsNotChangeComponentTest.java (original)
+++ camel/branches/camel-2.9.x/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointOptionsNotChangeComponentTest.java Tue Dec 4 22:29:54 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());
}
private static class MyBinding extends DefaultHttpBinding {
@@ -72,4 +77,8 @@ public class HttpEndpointOptionsNotChang
private static class MyOtherBinding extends DefaultHttpBinding {
}
+
+ private static class MyHeaderFilterStrategy extends HttpHeaderFilterStrategy {
+ }
+
}