Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

How to propagate the HTTP response headers from the Camel route to the cxfrs:bean

$
0
0
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

Viewing all articles
Browse latest Browse all 5648

Trending Articles