[
https://issues.apache.org/jira/browse/CAMEL-7246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14030519#comment-14030519
]
Raúl Kripalani commented on CAMEL-7246:
---------------------------------------
Hi [~ay],
The issue lies here:
http://grepcode.com/file/repo1.maven.org/maven2/org.apache.camel/camel-cxf/2.12.0/org/apache/camel/component/cxf/jaxrs/SimpleCxfRsBinding.java#181
The Simple Binding propagates the message headers from Camel into the JAX-RS
Response headers. However, since headers are not contextualised (as I explained
above) and they are just "mished-mashed", the Content-Type from the original
requests ends up being propagated back in the response.
The CXF stack then uses this Content-Type to pick the MessageBodyWriter and
ends up serialising the response in the same wireformat as the request, even if
the client demanded a different one with "Accept".
In my opinion there is no black or white solution, nor easy solution. We want
to allow users to set headers in their routes that are sent back to the client,
yet this facility is colliding with Camel's way of dumping all headers in the
same place.
For an easy solution out, we could add a parameter to SimpleConsumer:
headerPropagationPolicy, with the following values:
* none => never propagate any headers.
* propagate => apply header filter strategy (today's behaviour).
This parameter allows some level of tuning, and, most importantly, makes the
user aware upfront that if they want to propagate at least 1 header, they will
have to configure a header filter strategy.
[~amarkevich], for now you can solve this issue simply by removing the
Content-Type header before the end of the route.
Regards,
Raúl.
> [cxfrs] SimpleConsumer returns wrong Content-Type
> -------------------------------------------------
>
> Key: CAMEL-7246
> URL: https://issues.apache.org/jira/browse/CAMEL-7246
> Project: Camel
> Issue Type: Bug
> Components: camel-cxf
> Affects Versions: 2.12.2
> Reporter: Alexey Markevich
> Attachments: camel-cxfrs-content-type.zip
>
>
> Looks like Content-Type is taken from request
--
This message was sent by Atlassian JIRA
(v6.2#6252)