You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Gershaw, Geoffrey A. " <ge...@credit-suisse.com> on 2016/02/25 22:47:04 UTC

Checking the body type of an exchange using simple

Hello,

I am trying to use header.type in simple to determine the type of the body. I have tried many variations of header ie (in.header, headers) etc, but it always seems like type and BodyType are empty or null.

I have tried with Camel 2.16.1 and 2.16.2. I assume I'm missing something basic.

<camel:log message="HELLO ${header.type}"/>

Thanks,


Geoffrey A Gershaw

=============================================================================== 
Please access the attached hyperlink for an important electronic communications disclaimer: 
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
=============================================================================== 

Re: Checking the body type of an exchange using simple

Posted by Claus Ibsen <cl...@gmail.com>.
If you want to log the type, the you can get the class name

${header.foo.class.name}

(you can omit the getXXX and do XXX)

If you want to check if a body is a specific type using instanceof
then use the is operator

${body} is 'String'

http://camel.apache.org/simple

On Thu, Feb 25, 2016 at 10:47 PM, Gershaw, Geoffrey A.
<ge...@credit-suisse.com> wrote:
> Hello,
>
> I am trying to use header.type in simple to determine the type of the body. I have tried many variations of header ie (in.header, headers) etc, but it always seems like type and BodyType are empty or null.
>
> I have tried with Camel 2.16.1 and 2.16.2. I assume I'm missing something basic.
>
> <camel:log message="HELLO ${header.type}"/>
>
> Thanks,
>
>
> Geoffrey A Gershaw
>
> ===============================================================================
> Please access the attached hyperlink for an important electronic communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
> ===============================================================================



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2