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 2014/05/26 09:54:25 UTC
[1/6] git commit: CAMEL-7457 fixed the test error and added an unit
test for CxfRsHeaderFilterStrategy
Repository: camel
Updated Branches:
refs/heads/camel-2.12.x 72108c432 -> 1cfa6b67e
refs/heads/camel-2.13.x b520a4447 -> 1dc303183
CAMEL-7457 fixed the test error and added an unit test for CxfRsHeaderFilterStrategy
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/09bdee8c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/09bdee8c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/09bdee8c
Branch: refs/heads/camel-2.13.x
Commit: 09bdee8c930a6065204a9efdbac2d40fcc90c5b8
Parents: 194f193
Author: Willem Jiang <wi...@gmail.com>
Authored: Mon May 26 12:23:47 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon May 26 15:24:17 2014 +0800
----------------------------------------------------------------------
.../cxf/jaxrs/CxfRsHeaderFilterStrategy.java | 2 +-
.../jaxrs/CxfRsHeaderFilterStrategyTest.java | 42 ++++++++++++++++++++
2 files changed, 43 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/09bdee8c/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
index fc69c60..4972d99 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
@@ -40,7 +40,7 @@ public class CxfRsHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
getOutFilter().add(Exchange.HTTP_PATH);
getOutFilter().add(Exchange.DESTINATION_OVERRIDE_URL);
// filter headers begin with "Camel" or "org.apache.camel"
- setOutFilterPattern("((Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]|(?i)Content-Type)*");
+ setOutFilterPattern("((Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*)|(?i)Content-Type");
}
http://git-wip-us.apache.org/repos/asf/camel/blob/09bdee8c/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategyTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategyTest.java
new file mode 100644
index 0000000..eab6c41
--- /dev/null
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategyTest.java
@@ -0,0 +1,42 @@
+/**
+ * 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.cxf.jaxrs;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.component.cxf.common.message.CxfConstants;
+import org.apache.camel.spi.HeaderFilterStrategy;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class CxfRsHeaderFilterStrategyTest extends Assert {
+ @Test
+ public void testFilterContentType() throws Exception {
+ HeaderFilterStrategy filter = new CxfRsHeaderFilterStrategy();
+ assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders("content-type","just a test", null));
+ assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders("Content-Type","just a test", null));
+ }
+
+ @Test
+ public void testFilterCamelHeaders() throws Exception {
+ HeaderFilterStrategy filter = new CxfRsHeaderFilterStrategy();
+ assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders(Exchange.CHARSET_NAME,"just a test", null));
+ assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS, "just a test", null));
+ assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders("org.apache.camel.such.Header","just a test", null));
+ assertFalse("Get a wrong filtered result", filter.applyFilterToCamelHeaders("camel.result", "just a test", null));
+ }
+
+}
[4/6] git commit: CAMEL-7457 Does not override the "Content-Type"
header of CXF response
Posted by ni...@apache.org.
CAMEL-7457 Does not override the "Content-Type" header of CXF response
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ce3f8ee5
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ce3f8ee5
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ce3f8ee5
Branch: refs/heads/camel-2.12.x
Commit: ce3f8ee5b963c968e0e1b201c1a1cd896313b4d4
Parents: 72108c4
Author: Seiji Sogabe <so...@buildria.com>
Authored: Sun May 25 21:44:14 2014 +0900
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon May 26 15:38:38 2014 +0800
----------------------------------------------------------------------
.../camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ce3f8ee5/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
index 50a31e0..fc69c60 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
@@ -40,7 +40,7 @@ public class CxfRsHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
getOutFilter().add(Exchange.HTTP_PATH);
getOutFilter().add(Exchange.DESTINATION_OVERRIDE_URL);
// filter headers begin with "Camel" or "org.apache.camel"
- setOutFilterPattern("(Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*");
+ setOutFilterPattern("((Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]|(?i)Content-Type)*");
}
[2/6] git commit: CAMEL-7457 Does not override the "Content-Type"
header of CXF response
Posted by ni...@apache.org.
CAMEL-7457 Does not override the "Content-Type" header of CXF response
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/194f1931
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/194f1931
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/194f1931
Branch: refs/heads/camel-2.13.x
Commit: 194f1931818fa9f2639778ba0a8354b2b311f144
Parents: b520a44
Author: Seiji Sogabe <so...@buildria.com>
Authored: Sun May 25 21:44:14 2014 +0900
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon May 26 15:24:17 2014 +0800
----------------------------------------------------------------------
.../camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/194f1931/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
index 50a31e0..fc69c60 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
@@ -40,7 +40,7 @@ public class CxfRsHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
getOutFilter().add(Exchange.HTTP_PATH);
getOutFilter().add(Exchange.DESTINATION_OVERRIDE_URL);
// filter headers begin with "Camel" or "org.apache.camel"
- setOutFilterPattern("(Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*");
+ setOutFilterPattern("((Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]|(?i)Content-Type)*");
}
[5/6] git commit: CAMEL-7457 fixed the test error and added an unit
test for CxfRsHeaderFilterStrategy
Posted by ni...@apache.org.
CAMEL-7457 fixed the test error and added an unit test for CxfRsHeaderFilterStrategy
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/74707f74
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/74707f74
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/74707f74
Branch: refs/heads/camel-2.12.x
Commit: 74707f74b116ffe6b16beb15b5772daa048a9889
Parents: ce3f8ee
Author: Willem Jiang <wi...@gmail.com>
Authored: Mon May 26 12:23:47 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon May 26 15:38:39 2014 +0800
----------------------------------------------------------------------
.../cxf/jaxrs/CxfRsHeaderFilterStrategy.java | 2 +-
.../jaxrs/CxfRsHeaderFilterStrategyTest.java | 42 ++++++++++++++++++++
2 files changed, 43 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/74707f74/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
index fc69c60..4972d99 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
@@ -40,7 +40,7 @@ public class CxfRsHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
getOutFilter().add(Exchange.HTTP_PATH);
getOutFilter().add(Exchange.DESTINATION_OVERRIDE_URL);
// filter headers begin with "Camel" or "org.apache.camel"
- setOutFilterPattern("((Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]|(?i)Content-Type)*");
+ setOutFilterPattern("((Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*)|(?i)Content-Type");
}
http://git-wip-us.apache.org/repos/asf/camel/blob/74707f74/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategyTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategyTest.java
new file mode 100644
index 0000000..eab6c41
--- /dev/null
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategyTest.java
@@ -0,0 +1,42 @@
+/**
+ * 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.cxf.jaxrs;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.component.cxf.common.message.CxfConstants;
+import org.apache.camel.spi.HeaderFilterStrategy;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class CxfRsHeaderFilterStrategyTest extends Assert {
+ @Test
+ public void testFilterContentType() throws Exception {
+ HeaderFilterStrategy filter = new CxfRsHeaderFilterStrategy();
+ assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders("content-type","just a test", null));
+ assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders("Content-Type","just a test", null));
+ }
+
+ @Test
+ public void testFilterCamelHeaders() throws Exception {
+ HeaderFilterStrategy filter = new CxfRsHeaderFilterStrategy();
+ assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders(Exchange.CHARSET_NAME,"just a test", null));
+ assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS, "just a test", null));
+ assertTrue("Get a wrong filtered result", filter.applyFilterToCamelHeaders("org.apache.camel.such.Header","just a test", null));
+ assertFalse("Get a wrong filtered result", filter.applyFilterToCamelHeaders("camel.result", "just a test", null));
+ }
+
+}
[6/6] git commit: CAMEL-7457 polish the code with the suggestion of
Clause
Posted by ni...@apache.org.
CAMEL-7457 polish the code with the suggestion of Clause
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1cfa6b67
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1cfa6b67
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1cfa6b67
Branch: refs/heads/camel-2.12.x
Commit: 1cfa6b67e5e0edd376ed3fe6387e4b166a626b19
Parents: 74707f7
Author: Willem Jiang <wi...@gmail.com>
Authored: Mon May 26 14:31:57 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon May 26 15:38:39 2014 +0800
----------------------------------------------------------------------
.../cxf/jaxrs/CxfRsHeaderFilterStrategy.java | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/1cfa6b67/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
index 4972d99..bf73a3f 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
@@ -31,16 +31,15 @@ public class CxfRsHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
}
protected void initialize() {
- getOutFilter().add(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS);
- getOutFilter().add(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API);
- getOutFilter().add(CxfConstants.CAMEL_CXF_RS_OPERATION_RESOURCE_INFO_STACK);
- getOutFilter().add(CxfConstants.CAMEL_CXF_RS_VAR_VALUES);
- getOutFilter().add(CxfConstants.OPERATION_NAME);
- getOutFilter().add(Exchange.HTTP_METHOD);
- getOutFilter().add(Exchange.HTTP_PATH);
- getOutFilter().add(Exchange.DESTINATION_OVERRIDE_URL);
+
+ getOutFilter().add(CxfConstants.OPERATION_NAME.toLowerCase());
+
+ getOutFilter().add("Content-Type".toLowerCase());
+ // Support to filter the Content-Type case insensitive
+ setLowerCase(true);
+
// filter headers begin with "Camel" or "org.apache.camel"
- setOutFilterPattern("((Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*)|(?i)Content-Type");
+ setOutFilterPattern("(Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*");
}
[3/6] git commit: CAMEL-7457 polish the code with the suggestion of
Clause
Posted by ni...@apache.org.
CAMEL-7457 polish the code with the suggestion of Clause
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1dc30318
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1dc30318
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1dc30318
Branch: refs/heads/camel-2.13.x
Commit: 1dc303183b7a05b426dadf7cc1b6c916c96ec471
Parents: 09bdee8
Author: Willem Jiang <wi...@gmail.com>
Authored: Mon May 26 14:31:57 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon May 26 15:24:18 2014 +0800
----------------------------------------------------------------------
.../cxf/jaxrs/CxfRsHeaderFilterStrategy.java | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/1dc30318/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
index 4972d99..bf73a3f 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
@@ -31,16 +31,15 @@ public class CxfRsHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
}
protected void initialize() {
- getOutFilter().add(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS);
- getOutFilter().add(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API);
- getOutFilter().add(CxfConstants.CAMEL_CXF_RS_OPERATION_RESOURCE_INFO_STACK);
- getOutFilter().add(CxfConstants.CAMEL_CXF_RS_VAR_VALUES);
- getOutFilter().add(CxfConstants.OPERATION_NAME);
- getOutFilter().add(Exchange.HTTP_METHOD);
- getOutFilter().add(Exchange.HTTP_PATH);
- getOutFilter().add(Exchange.DESTINATION_OVERRIDE_URL);
+
+ getOutFilter().add(CxfConstants.OPERATION_NAME.toLowerCase());
+
+ getOutFilter().add("Content-Type".toLowerCase());
+ // Support to filter the Content-Type case insensitive
+ setLowerCase(true);
+
// filter headers begin with "Camel" or "org.apache.camel"
- setOutFilterPattern("((Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*)|(?i)Content-Type");
+ setOutFilterPattern("(Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*");
}