CAMEL-9599: camel-cxfrs in simple binding mode should not use content-length header from input message in the response.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bdbfc178 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bdbfc178 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bdbfc178 Branch: refs/heads/camel-2.15.x Commit: bdbfc17832fa35d8d0eaa5c42bf81f178fffc86b Parents: cd7e6fc Author: Claus Ibsen <davscl...@apache.org> Authored: Sat Feb 13 17:53:10 2016 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sat Feb 13 17:54:08 2016 +0100 ---------------------------------------------------------------------- .../apache/camel/component/cxf/jaxrs/SimpleCxfRsBinding.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/bdbfc178/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/SimpleCxfRsBinding.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/SimpleCxfRsBinding.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/SimpleCxfRsBinding.java index 9aa8e11..9bccb1f 100644 --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/SimpleCxfRsBinding.java +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/SimpleCxfRsBinding.java @@ -191,9 +191,6 @@ public class SimpleCxfRsBinding extends DefaultCxfRsBinding { * <p /> * The {@link DefaultCxfRsBinding} doesn't filter the response headers according to the {@link HeaderFilterStrategy}, * so we handle this task in this binding. - * @param headers - * @param camelExchange - * @return */ protected Map<String, String> filterCamelHeadersForResponseHeaders(Map<String, Object> headers, org.apache.camel.Exchange camelExchange) { @@ -202,6 +199,11 @@ public class SimpleCxfRsBinding extends DefaultCxfRsBinding { if (getHeaderFilterStrategy().applyFilterToCamelHeaders(entry.getKey(), entry.getValue(), camelExchange)) { continue; } + // skip content-length as the simple binding with Response will set correct content-length based + // on the entity set as the Response + if ("content-length".equalsIgnoreCase(entry.getKey())) { + continue; + } answer.put(entry.getKey(), entry.getValue().toString()); } return answer;