You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Ton Swieb <to...@finalist.nl> on 2014/11/18 17:35:39 UTC
How to propagate the HTTP response headers from the Camel route to
the cxfrs:bean
Hi,
I am using CXFRS bean in combination with Camel and I would like to set a
custom HTTP response from within the Camel route, but without making my own
CXF Response object.
I have a route like:
from("cxfrs:bean:restService?binding=#cxfrsBinding")
.setHeader(HttpHeaders.CONTENT_LANGUAGE,constant("EN"))
The HTTP response generated by CXFRS does not contain the custom header.
I tried to set a custom HeaderFilterStrategy based on
CxfRsHeaderFilterStrategy:
public class HeaderFilterStrategy extends CxfRsHeaderFilterStrategy {
@Override
protected void initialize() {
super.initialize();
getInFilter().add(HttpHeaders.CONTENT_LANGUAGE);
getOutFilter().add(HttpHeaders.CONTENT_LANGUAGE);
}
}
and supplied it to CXF-RS using the default CXFRS binding:
<bean id="cxfrsBinding"
class="org.apache.camel.component.cxf.jaxrs.DefaultCxfRsBinding">
<property name="headerFilterStrategy" ref= "headerFilterStrategy"/>
</bean>
But that didn't work.
Any ideas how to get this working without using a CXF Response object?
I am using Camel 2.10.0.redhat-60024 and CXF 2.6.0.redhat-60024
Regards,
Ton