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 15:43:18 UTC
[1/6] camel git commit: CAMEL-8774 Fixed the issue of copying the
protocol headers in camel-jetty
Repository: camel
Updated Branches:
refs/heads/camel-2.15.x 3c33808a0 -> 9e23c99b5
CAMEL-8774 Fixed the issue of copying the protocol headers in camel-jetty
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1c899e66
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1c899e66
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1c899e66
Branch: refs/heads/camel-2.15.x
Commit: 1c899e6621e48f47f6e2f429d9345cda26c8a68e
Parents: 3c33808
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 21:39:39 2015 +0800
----------------------------------------------------------------------
.../org/apache/camel/util/MessageHelper.java | 2 +-
.../apache/camel/util/MessageHelperTest.java | 2 +-
.../http/HttpProtocolHeaderFilterStrategy.java | 88 ++++++++++++++++++++
.../jetty/DefaultJettyHttpBinding.java | 6 +-
4 files changed, 94 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/1c899e66/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 49d2170..77fa472 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
@@ -493,7 +493,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/1c899e66/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 fb08ab6..552db9f 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
@@ -131,7 +131,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/1c899e66/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/1c899e66/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
index 2ee5a64..fe3195f 100644
--- a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
+++ b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
@@ -28,6 +28,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;
@@ -42,6 +43,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;
public DefaultJettyHttpBinding() {
@@ -122,8 +124,8 @@ public class DefaultJettyHttpBinding implements JettyHttpBinding {
// preserve headers from in by copying any non existing headers
// to avoid overriding existing headers with old values
- // We also need to apply the HeaderFilterStrategy here
- 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
[4/6] 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/0fe2143a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0fe2143a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0fe2143a
Branch: refs/heads/camel-2.15.x
Commit: 0fe2143af5238a5f18f5b94368feb7ac61780f89
Parents: 5e0c02d
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 21:40:05 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/0fe2143a/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/0fe2143a/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);
+ }
+}
[2/6] 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/7ba4b7ba
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7ba4b7ba
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7ba4b7ba
Branch: refs/heads/camel-2.15.x
Commit: 7ba4b7ba8118a95b62b419bd20404606e55a4175
Parents: 1c899e6
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 21:39:47 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/7ba4b7ba/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 ebef9e7..f2bdc2d 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 {
[5/6] camel git commit: Upgrade CXF
Posted by ni...@apache.org.
Upgrade CXF
Conflicts:
parent/pom.xml
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c5ba44bc
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c5ba44bc
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c5ba44bc
Branch: refs/heads/camel-2.15.x
Commit: c5ba44bc397213b6a9bfe50b70235100cc19365e
Parents: 0fe2143
Author: Claus Ibsen <da...@apache.org>
Authored: Wed May 27 11:11:19 2015 +0200
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed May 27 21:42:15 2015 +0800
----------------------------------------------------------------------
parent/pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/c5ba44bc/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 6736c6a..885a2d9 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -121,9 +121,9 @@
<commons-vfs2-version>2.0</commons-vfs2-version>
<concurrentlinkedhashmap.version>1.4.2</concurrentlinkedhashmap.version>
<cobertura-maven-plugin-version>2.5.2</cobertura-maven-plugin-version>
- <cxf-version>3.0.4</cxf-version>
+ <cxf-version>3.0.5</cxf-version>
<cxf-version-range>[2.7,4.0)</cxf-version-range>
- <cxf-xjc-utils-version>3.0.2</cxf-xjc-utils-version>
+ <cxf-xjc-utils-version>3.0.3</cxf-xjc-utils-version>
<deltaspike-version>1.2.1</deltaspike-version>
<derby-version>10.11.1.1</derby-version>
<disruptor-version>3.3.2</disruptor-version>
[6/6] camel git commit: CAMEL-8802 Upgraded CXF version to 3.0.5
Posted by ni...@apache.org.
CAMEL-8802 Upgraded CXF version to 3.0.5
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9e23c99b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9e23c99b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9e23c99b
Branch: refs/heads/camel-2.15.x
Commit: 9e23c99b501925f68dd53f0de10d5bfe69281185
Parents: c5ba44b
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed May 27 21:35:09 2015 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed May 27 21:42:41 2015 +0800
----------------------------------------------------------------------
.../cxf/jaxrs/simplebinding/CxfRsConsumerSimpleBindingTest.java | 2 +-
.../cxf/jaxrs/simplebinding/testbean/MultipartCustomer.java | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/9e23c99b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/simplebinding/CxfRsConsumerSimpleBindingTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/simplebinding/CxfRsConsumerSimpleBindingTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/simplebinding/CxfRsConsumerSimpleBindingTest.java
index 8cfe283..be3c9d8 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/simplebinding/CxfRsConsumerSimpleBindingTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/simplebinding/CxfRsConsumerSimpleBindingTest.java
@@ -307,7 +307,7 @@ public class CxfRsConsumerSimpleBindingTest extends CamelTestSupport {
@Test
public void testMultipartPostWithoutParameters() throws Exception {
- HttpPost post = new HttpPost("http://localhost:" + PORT_PATH + "/rest/customerservice/customers/multipart");
+ HttpPost post = new HttpPost("http://localhost:" + PORT_PATH + "/rest/customerservice/customers/multipart/withoutParameters");
MultipartEntityBuilder builder = MultipartEntityBuilder.create().setMode(HttpMultipartMode.STRICT);
builder.addBinaryBody("part1", new File(this.getClass().getClassLoader().getResource("java.jpg").toURI()), ContentType.create("image/jpeg"), "java.jpg");
builder.addBinaryBody("part2", new File(this.getClass().getClassLoader().getResource("java.jpg").toURI()), ContentType.create("image/jpeg"), "java.jpg");
http://git-wip-us.apache.org/repos/asf/camel/blob/9e23c99b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/simplebinding/testbean/MultipartCustomer.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/simplebinding/testbean/MultipartCustomer.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/simplebinding/testbean/MultipartCustomer.java
index 7281e6e..66f08ab 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/simplebinding/testbean/MultipartCustomer.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/simplebinding/testbean/MultipartCustomer.java
@@ -36,7 +36,8 @@ public class MultipartCustomer {
return null;
}
- @POST
+ @POST @Path("/withoutParameters")
+ // Added the path due to change of CXF-6321
public Response multipartPostWithoutParameters(
@Multipart(value = "part1", type = "image/jpeg") DataHandler dh1,
@Multipart(value = "part2", type = "image/jpeg") DataHandler dh2,
[3/6] 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/5e0c02d2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5e0c02d2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5e0c02d2
Branch: refs/heads/camel-2.15.x
Commit: 5e0c02d249db38caae60d1715538e78713638daf
Parents: 7ba4b7b
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 21:39:56 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/5e0c02d2/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 53f9221..a301f54 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/5e0c02d2/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/5e0c02d2/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));
}