Hi Marc,

It maybe a bug of camel-cxf component, I will look it tommorrow.
Please feel free to fill a JIRA[1] for it.

[1] https://issues.apache.org/activemq/browse/CAMEL

Willem

Marc Giger wrote:
> Hi Willem,
> 
> In my case the entry point is a cxfEndpoint. My route looks
> like the following:
> 
> from("cxf:bean:routerEndpoint?dataFormat=MESSAGE").
>                 processRef("uniqueIDProcessor").
>                 processRef("decryptProcessor").
>                 processRef("idProcessor").
>                 processRef("messageStoreProcessor").
>                 processRef("logProcessor").
>                 choice().
>                     when().
>                         method("endpointSelector", "matches").
>                         to("bean:invokeProcessor").
>                     otherwise().
>                         to("cxf:bean:localEndpoint?dataFormat=MESSAGE");
> 
> I have to return the contentType/contentEncoding from the localEndpoint 
> through
> the routerEndpoint back to the client. This worked until camel 1.6
> 
> In the method CxfHeaderHelper.propagateCxfToCamel() there is a try to copy
> the CONTENT_TYPE but it can't be found because it doesn't exist in the 
> Message-Object
> but in the WrappedMessageContext.
> 
> I think a solution to my problem would be to write an interceptor for
> the routerEndpoint bean and copy the needed headers...
> Is there a easier/better solution?
> 
> Thanks
> 
> Marc
> 
> 
> 
> On Tue, 05 May 2009 16:53:06 +0800
> Willem Jiang <[email protected]> wrote:
> 
>> Hi Marc,
>>
>> I'm sorry that I misunderstand your question.
>>
>> Since we don't use CXFMessage to store CXF message for better support
>> routing the message between cxf and other endpoints, the original CXF
>> message context maybe lost between the CXF endpoints.
>>
>> If you just want to Camel route work as proxy, you can use camel-jetty
>> component to do that, and you can control the http header and the
>> content-type by apply your HttpBinding or HeaderFilterStrategy.
>> The route rule could like this
>>
>> from("jetty://http://localhost:9001/router";).to("http://localhost:9002/helloworld";);
>>
>> You can setup the HttpBinding or HeaderFilterStrategy by adding a
>> customized JettyComponent in your Spring configuration file.
>>
>> <bean id="jetty" class="org.apache.camel.component.jetty.JettyComponent">
>>      <property name="Httpbinding">
>>              <bean class="YourHTTPBinding"/>                         
>>      </property>
>>         <property name="HeaderFilterStrategy">
>>              <bean class="YourHeaderFilterStrategy"/>                        
>>      </property>
>>   </bean>
>>
>> Willem
>>
>>
>> Marc Giger wrote:
>>> Hi Willem,
>>>
>>> How to get the headers in a route is not the problem but how
>>> to send specific headers back to the client. I saw there is a
>>> new mechanism in camel 1.6 to filter specific headers. E.g. 
>>> CxfHeaderFilterStrategy.
>>> How can I apply a customized filter strategy to the spring-declared 
>>> endpoints?
>>>
>>> Thanks
>>>
>>> Marc
>>>
>>>
>>> On Tue, 05 May 2009 11:03:32 +0800
>>> Willem Jiang <[email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>> You can get the content-type and response code with below code example
>>>> in Camel 1.x .
>>>>
>>>>  Map context = (Map)exchange.getIn().getHeaders().get("ResponseContext");
>>>>         assertNotNull("Expect to get the protocal header ",
>>>> context.get("org.apache.cxf.message.Message.PROTOCOL_HEADERS"));
>>>> Map protocalHeaders = (Map)
>>>> context.context.get("org.apache.cxf.message.Message.PROTOCOL_HEADERS");
>>>> String contentType = protocalHeaders.get("content-type");
>>>> int responseCode =
>>>> context.get("org.apache.cxf.message.Message.RESPONSE_CODE");
>>>>
>>>> In Camel 2.0, you can get the context-type directly from the message 
>>>> header.
>>>>
>>>> Willem
>>>>
>>>> Marc Giger wrote:
>>>>> Hi all,
>>>>>
>>>>> I'm missing the content-type http response header in camel-cxf 1.6 
>>>>> (cxf:bean:localEndpoint?dataFormat=MESSAGE)
>>>>>
>>>>> HTTP/1.1 200 OK
>>>>> Content-Length: 4648
>>>>> Server: Jetty(6.1.10)
>>>>>
>>>>> or
>>>>>
>>>>> HTTP/1.1 500 Internal Server Error
>>>>> Content-Length: 253
>>>>> Server: Jetty(6.1.10)
>>>>>
>>>>> What do I have to do to get it back?:-)
>>>>> I've lost the overview...
>>>>>
>>>>> Thanks a lot!
>>>>>
>>>>> Marc
>>>>>
>>>>>
>>>
> 
> 

Reply via email to