Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
https://camel.apache.org/staging/
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.

Convert the message body to the given class type. To do so camel uses a hierarchy of TypeConverters

Syntax

Java

convertBodyTo(Class type [, String charset])

Spring XML

<convertBodyTo type="<String>" [charset="<String>"] >

Parameters

Parameter

Type

Description

type

Class

Class type to convert to. For spring dsl use the Fully qualified name

charset

String

charset name for conversions from byte to String

Examples

convert to Java String

Java

convertBodyTo(String.class)

Spring XML Schema

<convertBodyTo type="java.lang.String"/>

Other types to use:

  • org.w3c.dom.Document: If you read xml files and want the encoding from the xml to be used
  • javax.xml.transform.stream.StreamSource: Streaming source for xml
  • InputStream
  • byte[]
© 2004-2015 The Apache Software Foundation.
Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram