camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From harald <sunny...@rainyday.de>
Subject Routing based on exchange header content-type
Date Tue, 19 Aug 2014 18:50:40 GMT
Hello,

I just wanted to extend my routing

<route>
  <from  uri=“jetty:// .. “/>
  <inOut uri=“bean:call?method=me(*)”/>
</route>

by a content routing based on the HTTP header ‘Content-Type’ like

<route>
  <from  uri=“jetty:// .. “/>
  <choice>
    <when>
      <simple>${in.headers[‘Content-Type’] == ‘application/json’</simple>
      <to uri=“bean:call?method=me(*,true)”/>
    </when>
    <when>
      <simple>${in.headers[‘Content-Type’] == ‘application/xml’</simple>
      <to uri=“bean:call?method=me(*,false)”/>
    </when>
    <otherwise>
      <to uri=“bean:call?method=oldStyle(*)”/>
    </otherwise>
  </choice>
</route>

Using ‘headers’, ‘header’ with and without ‘in’ did not work. 

I think I thought to much about it. Thanks for any help.

regards,
harald
Mime
View raw message