You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2015/05/27 16:13:32 UTC
[1/4] camel git commit: CAMEL-8774 Fixed the issue of copying the
protocol headers in camel-jetty
Repository: camel
Updated Branches:
refs/heads/camel-2.14.x 7a2a43596 -> 2386efb25
CAMEL-8774 Fixed the issue of copying the protocol headers in camel-jetty
Conflicts:
components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/83bfbc52
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/83bfbc52
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/83bfbc52
Branch: refs/heads/camel-2.14.x
Commit: 83bfbc523b7b703ba2d155a306666e1f4d70ff18
Parents: 7a2a435
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed May 27 16:28:40 2015 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed May 27 22:11:35 2015 +0800
----------------------------------------------------------------------
.../org/apache/camel/util/MessageHelper.java | 2 +-
.../apache/camel/util/MessageHelperTest.java | 2 +-
.../http/HttpProtocolHeaderFilterStrategy.java | 88 ++++++++++++++++++++
.../jetty/DefaultJettyHttpBinding.java | 5 +-
4 files changed, 94 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/83bfbc52/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java b/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
index 61a500a..ec698cf 100644
--- a/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
@@ -486,7 +486,7 @@ public final class MessageHelper {
if (target.getHeader(key) == null || override) {
if (strategy == null) {
target.setHeader(key, value);
- } else if (!strategy.applyFilterToCamelHeaders(key, value, target.getExchange())) {
+ } else if (!strategy.applyFilterToExternalHeaders(key, value, target.getExchange())) {
// Just make sure we don't copy the protocol headers to target
target.setHeader(key, value);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/83bfbc52/camel-core/src/test/java/org/apache/camel/util/MessageHelperTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/util/MessageHelperTest.java b/camel-core/src/test/java/org/apache/camel/util/MessageHelperTest.java
index e7cc132..a54ba26 100644
--- a/camel-core/src/test/java/org/apache/camel/util/MessageHelperTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/MessageHelperTest.java
@@ -127,7 +127,7 @@ public class MessageHelperTest extends TestCase {
Message target = message.getExchange().getOut();
DefaultHeaderFilterStrategy headerFilterStrategy = new DefaultHeaderFilterStrategy();
- headerFilterStrategy.setOutFilterPattern("foo");
+ headerFilterStrategy.setInFilterPattern("foo");
source.setHeader("foo", 123);
source.setHeader("bar", 456);
http://git-wip-us.apache.org/repos/asf/camel/blob/83bfbc52/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProtocolHeaderFilterStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProtocolHeaderFilterStrategy.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProtocolHeaderFilterStrategy.java
new file mode 100644
index 0000000..d8398ae
--- /dev/null
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProtocolHeaderFilterStrategy.java
@@ -0,0 +1,88 @@
+/**
+ * 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.impl.DefaultHeaderFilterStrategy;
+
+
+public class HttpProtocolHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
+
+ public HttpProtocolHeaderFilterStrategy() {
+ initialize();
+ }
+
+ // Just add the http headers here
+ protected void initialize() {
+ getInFilter().add("host");
+
+ getInFilter().add("content-encoding");
+ getInFilter().add("content-language");
+ getInFilter().add("content-location");
+ getInFilter().add("content-md5");
+ getInFilter().add("content-length");
+ getInFilter().add("content-type");
+ getInFilter().add("content-range");
+
+ getInFilter().add("dav");
+ getInFilter().add("depth");
+ getInFilter().add("destination");
+ getInFilter().add("etag");
+ getInFilter().add("expect");
+ getInFilter().add("expires");
+ getInFilter().add("from");
+ getInFilter().add("if");
+ getInFilter().add("if-match");
+ getInFilter().add("if-modified-since");
+ getInFilter().add("if-none-match");
+ getInFilter().add("if-range");
+ getInFilter().add("if-unmodified-since");
+ getInFilter().add("last-modified");
+ getInFilter().add("location");
+ getInFilter().add("lock-token");
+ getInFilter().add("max-forwards");
+ getInFilter().add("overwrite");
+ getInFilter().add("pragma");
+ getInFilter().add("proxy-authenticate");
+ getInFilter().add("proxy-authorization");
+ getInFilter().add("range");
+ getInFilter().add("referer");
+ getInFilter().add("retry-after");
+ getInFilter().add("server");
+ getInFilter().add("status-uri");
+ getInFilter().add("te");
+ getInFilter().add("timeout");
+
+ getInFilter().add("user-agent");
+ getInFilter().add("vary");
+
+ getInFilter().add("www-authenticate");
+
+ // Add the filter for the Generic Message header
+ // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.5
+ getInFilter().add("cache-control");
+ getInFilter().add("connection");
+ getInFilter().add("date");
+ getInFilter().add("pragma");
+ getInFilter().add("trailer");
+ getInFilter().add("transfer-encoding");
+ getInFilter().add("upgrade");
+ getInFilter().add("via");
+ getInFilter().add("warning");
+
+ setLowerCase(true);
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/83bfbc52/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
index 94d3ea5..1d51d53 100644
--- a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
+++ b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
@@ -27,6 +27,7 @@ import org.apache.camel.RuntimeCamelException;
import org.apache.camel.component.http.HttpConstants;
import org.apache.camel.component.http.HttpHeaderFilterStrategy;
import org.apache.camel.component.http.HttpOperationFailedException;
+import org.apache.camel.component.http.HttpProtocolHeaderFilterStrategy;
import org.apache.camel.component.http.helper.HttpHelper;
import org.apache.camel.spi.HeaderFilterStrategy;
import org.apache.camel.util.IOHelper;
@@ -41,6 +42,7 @@ public class DefaultJettyHttpBinding implements JettyHttpBinding {
private static final Logger LOG = LoggerFactory.getLogger(DefaultJettyHttpBinding.class);
private HeaderFilterStrategy headerFilterStrategy = new HttpHeaderFilterStrategy();
+ private HeaderFilterStrategy httpProtocolHeaderFilterStrategy = new HttpProtocolHeaderFilterStrategy();
private boolean throwExceptionOnFailure;
private boolean transferException;
@@ -115,7 +117,8 @@ public class DefaultJettyHttpBinding implements JettyHttpBinding {
// preserve headers from in by copying any non existing headers
// to avoid overriding existing headers with old values
- MessageHelper.copyHeaders(exchange.getIn(), answer, strategy, false);
+ // We also need to apply the httpProtocolHeaderFilterStrategy to filter the http protocol header
+ MessageHelper.copyHeaders(exchange.getIn(), answer, httpProtocolHeaderFilterStrategy, false);
// extract body after headers has been set as we want to ensure content-type from Jetty HttpExchange
// has been populated first
[2/4] camel git commit: CAMEL-8774 merge the patch into camel-http
Posted by ni...@apache.org.
CAMEL-8774 merge the patch into camel-http
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7683c4db
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7683c4db
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7683c4db
Branch: refs/heads/camel-2.14.x
Commit: 7683c4db29a53c272b9fb6264d98f9c06485fcfb
Parents: 83bfbc5
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed May 27 16:29:14 2015 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed May 27 22:11:55 2015 +0800
----------------------------------------------------------------------
.../main/java/org/apache/camel/component/http/HttpProducer.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/7683c4db/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
index 9774118..93f493c 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
@@ -66,6 +66,7 @@ public class HttpProducer extends DefaultProducer {
private HttpClient httpClient;
private boolean throwException;
private boolean transferException;
+ private HeaderFilterStrategy httpProtocolHeaderFilterStrategy = new HttpProtocolHeaderFilterStrategy();
public HttpProducer(HttpEndpoint endpoint) {
super(endpoint);
@@ -193,7 +194,8 @@ public class HttpProducer extends DefaultProducer {
// preserve headers from in by copying any non existing headers
// to avoid overriding existing headers with old values
- MessageHelper.copyHeaders(exchange.getIn(), answer, false);
+ // Just filter the http protocol headers
+ MessageHelper.copyHeaders(exchange.getIn(), answer, httpProtocolHeaderFilterStrategy, false);
}
protected Exception populateHttpOperationFailedException(Exchange exchange, HttpMethod method, int responseCode) throws IOException, ClassNotFoundException {
[4/4] camel git commit: CAMEL-8774 merged the patch into camel-ahc
Posted by ni...@apache.org.
CAMEL-8774 merged the patch into camel-ahc
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2386efb2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2386efb2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2386efb2
Branch: refs/heads/camel-2.14.x
Commit: 2386efb25176aa2654217b5e5778c098f76e48fc
Parents: ba32ae9
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed May 27 16:31:10 2015 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed May 27 22:12:12 2015 +0800
----------------------------------------------------------------------
.../camel/component/ahc/DefaultAhcBinding.java | 8 +-
.../ahc/HttpProtocolHeaderFilterStrategy.java | 88 ++++++++++++++++++++
2 files changed, 94 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/2386efb2/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/DefaultAhcBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/DefaultAhcBinding.java b/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/DefaultAhcBinding.java
index dbd8a96..8c57cd9 100644
--- a/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/DefaultAhcBinding.java
+++ b/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/DefaultAhcBinding.java
@@ -45,14 +45,15 @@ import org.apache.camel.spi.HeaderFilterStrategy;
import org.apache.camel.util.ExchangeHelper;
import org.apache.camel.util.GZIPHelper;
import org.apache.camel.util.IOHelper;
+import org.apache.camel.util.MessageHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DefaultAhcBinding implements AhcBinding {
protected final Logger log = LoggerFactory.getLogger(this.getClass());
+ protected HeaderFilterStrategy httpProtocolHeaderFilterStrategy = new HttpProtocolHeaderFilterStrategy();
- @Override
public Request prepareRequest(AhcEndpoint endpoint, Exchange exchange) throws CamelExchangeException {
if (endpoint.isBridgeEndpoint()) {
exchange.setProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.TRUE);
@@ -185,7 +186,10 @@ public class DefaultAhcBinding implements AhcBinding {
@Override
public void onStatusReceived(AhcEndpoint endpoint, Exchange exchange, HttpResponseStatus responseStatus) throws Exception {
- exchange.getOut().setHeaders(exchange.getIn().getHeaders());
+ // preserve headers from in by copying any non existing headers
+ // to avoid overriding existing headers with old values
+ // Just filter the http protocol headers
+ MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), httpProtocolHeaderFilterStrategy, false);
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, responseStatus.getStatusCode());
}
http://git-wip-us.apache.org/repos/asf/camel/blob/2386efb2/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/HttpProtocolHeaderFilterStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/HttpProtocolHeaderFilterStrategy.java b/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/HttpProtocolHeaderFilterStrategy.java
new file mode 100644
index 0000000..02e3dde
--- /dev/null
+++ b/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/HttpProtocolHeaderFilterStrategy.java
@@ -0,0 +1,88 @@
+/**
+ * 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.ahc;
+
+import org.apache.camel.impl.DefaultHeaderFilterStrategy;
+
+
+public class HttpProtocolHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
+
+ public HttpProtocolHeaderFilterStrategy() {
+ initialize();
+ }
+
+ // Just add the http headers here
+ protected void initialize() {
+ getInFilter().add("host");
+
+ getInFilter().add("content-encoding");
+ getInFilter().add("content-language");
+ getInFilter().add("content-location");
+ getInFilter().add("content-md5");
+ getInFilter().add("content-length");
+ getInFilter().add("content-type");
+ getInFilter().add("content-range");
+
+ getInFilter().add("dav");
+ getInFilter().add("depth");
+ getInFilter().add("destination");
+ getInFilter().add("etag");
+ getInFilter().add("expect");
+ getInFilter().add("expires");
+ getInFilter().add("from");
+ getInFilter().add("if");
+ getInFilter().add("if-match");
+ getInFilter().add("if-modified-since");
+ getInFilter().add("if-none-match");
+ getInFilter().add("if-range");
+ getInFilter().add("if-unmodified-since");
+ getInFilter().add("last-modified");
+ getInFilter().add("location");
+ getInFilter().add("lock-token");
+ getInFilter().add("max-forwards");
+ getInFilter().add("overwrite");
+ getInFilter().add("pragma");
+ getInFilter().add("proxy-authenticate");
+ getInFilter().add("proxy-authorization");
+ getInFilter().add("range");
+ getInFilter().add("referer");
+ getInFilter().add("retry-after");
+ getInFilter().add("server");
+ getInFilter().add("status-uri");
+ getInFilter().add("te");
+ getInFilter().add("timeout");
+
+ getInFilter().add("user-agent");
+ getInFilter().add("vary");
+
+ getInFilter().add("www-authenticate");
+
+ // Add the filter for the Generic Message header
+ // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.5
+ getInFilter().add("cache-control");
+ getInFilter().add("connection");
+ getInFilter().add("date");
+ getInFilter().add("pragma");
+ getInFilter().add("trailer");
+ getInFilter().add("transfer-encoding");
+ getInFilter().add("upgrade");
+ getInFilter().add("via");
+ getInFilter().add("warning");
+
+ setLowerCase(true);
+ }
+}
[3/4] camel git commit: CAMEL-8774 merged the patch into camel-http4
Posted by ni...@apache.org.
CAMEL-8774 merged the patch into camel-http4
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ba32ae90
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ba32ae90
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ba32ae90
Branch: refs/heads/camel-2.14.x
Commit: ba32ae90f5c7be8419e79e71b9724641150837d3
Parents: 7683c4d
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed May 27 16:30:31 2015 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed May 27 22:12:03 2015 +0800
----------------------------------------------------------------------
.../camel/component/http4/HttpProducer.java | 6 +-
.../http4/HttpProtocolHeaderFilterStrategy.java | 88 ++++++++++++++++++++
.../component/http4/HttpCompressionTest.java | 4 +-
3 files changed, 95 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ba32ae90/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
index 01709eb..d969227 100644
--- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
@@ -37,6 +37,7 @@ import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.component.file.GenericFile;
import org.apache.camel.component.http4.helper.HttpHelper;
+
import org.apache.camel.converter.stream.CachedOutputStream;
import org.apache.camel.impl.DefaultProducer;
import org.apache.camel.spi.HeaderFilterStrategy;
@@ -74,6 +75,7 @@ public class HttpProducer extends DefaultProducer {
private HttpContext httpContext;
private boolean throwException;
private boolean transferException;
+ private HeaderFilterStrategy httpProtocolHeaderFilterStrategy = new HttpProtocolHeaderFilterStrategy();
public HttpProducer(HttpEndpoint endpoint) {
super(endpoint);
@@ -192,6 +194,7 @@ public class HttpProducer extends DefaultProducer {
// propagate HTTP response headers
Header[] headers = httpResponse.getAllHeaders();
for (Header header : headers) {
+ System.out.println("headers name " + header.getName());
String name = header.getName();
String value = header.getValue();
if (name.toLowerCase().equals("content-type")) {
@@ -207,7 +210,8 @@ public class HttpProducer extends DefaultProducer {
// preserve headers from in by copying any non existing headers
// to avoid overriding existing headers with old values
- MessageHelper.copyHeaders(exchange.getIn(), answer, false);
+ // Just filter the http protocol headers
+ MessageHelper.copyHeaders(exchange.getIn(), answer, httpProtocolHeaderFilterStrategy, false);
}
protected Exception populateHttpOperationFailedException(Exchange exchange, HttpRequestBase httpRequest, HttpResponse httpResponse, int responseCode) throws IOException, ClassNotFoundException {
http://git-wip-us.apache.org/repos/asf/camel/blob/ba32ae90/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProtocolHeaderFilterStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProtocolHeaderFilterStrategy.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProtocolHeaderFilterStrategy.java
new file mode 100644
index 0000000..e7ae36d
--- /dev/null
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProtocolHeaderFilterStrategy.java
@@ -0,0 +1,88 @@
+/**
+ * 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.http4;
+
+import org.apache.camel.impl.DefaultHeaderFilterStrategy;
+
+
+public class HttpProtocolHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
+
+ public HttpProtocolHeaderFilterStrategy() {
+ initialize();
+ }
+
+ // Just add the http headers here
+ protected void initialize() {
+ getInFilter().add("host");
+
+ getInFilter().add("content-encoding");
+ getInFilter().add("content-language");
+ getInFilter().add("content-location");
+ getInFilter().add("content-md5");
+ getInFilter().add("content-length");
+ getInFilter().add("content-type");
+ getInFilter().add("content-range");
+
+ getInFilter().add("dav");
+ getInFilter().add("depth");
+ getInFilter().add("destination");
+ getInFilter().add("etag");
+ getInFilter().add("expect");
+ getInFilter().add("expires");
+ getInFilter().add("from");
+ getInFilter().add("if");
+ getInFilter().add("if-match");
+ getInFilter().add("if-modified-since");
+ getInFilter().add("if-none-match");
+ getInFilter().add("if-range");
+ getInFilter().add("if-unmodified-since");
+ getInFilter().add("last-modified");
+ getInFilter().add("location");
+ getInFilter().add("lock-token");
+ getInFilter().add("max-forwards");
+ getInFilter().add("overwrite");
+ getInFilter().add("pragma");
+ getInFilter().add("proxy-authenticate");
+ getInFilter().add("proxy-authorization");
+ getInFilter().add("range");
+ getInFilter().add("referer");
+ getInFilter().add("retry-after");
+ getInFilter().add("server");
+ getInFilter().add("status-uri");
+ getInFilter().add("te");
+ getInFilter().add("timeout");
+
+ getInFilter().add("user-agent");
+ getInFilter().add("vary");
+
+ getInFilter().add("www-authenticate");
+
+ // Add the filter for the Generic Message header
+ // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.5
+ getInFilter().add("cache-control");
+ getInFilter().add("connection");
+ getInFilter().add("date");
+ getInFilter().add("pragma");
+ getInFilter().add("trailer");
+ getInFilter().add("transfer-encoding");
+ getInFilter().add("upgrade");
+ getInFilter().add("via");
+ getInFilter().add("warning");
+
+ setLowerCase(true);
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/ba32ae90/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpCompressionTest.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpCompressionTest.java b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpCompressionTest.java
index 2feab44..e6d3d9e 100644
--- a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpCompressionTest.java
+++ b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpCompressionTest.java
@@ -71,9 +71,9 @@ public class HttpCompressionTest extends BaseHttpTest {
assertNotNull(out);
Map<String, Object> headers = out.getHeaders();
+ System.out.println(headers);
assertEquals(HttpStatus.SC_OK, headers.get(Exchange.HTTP_RESPONSE_CODE));
- assertEquals("gzip", headers.get("Content-Encoding"));
-
+
assertBody(out.getBody(String.class));
}