camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ton Swieb <ton.sw...@finalist.nl>
Subject How to propagate the HTTP response headers from the Camel route to the cxfrs:bean
Date Tue, 18 Nov 2014 16:35:39 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message