camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: camel-cxf content-type response header
Date Tue, 05 May 2009 08:53:06 GMT
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 <willem.jiang@gmail.com> 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
>>>
>>>
> 
> 


Mime
View raw message