Repository: camel Updated Branches: refs/heads/master d0fbf731f -> 058c86661
Added camel-base64 docs to gitbook Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/058c8666 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/058c8666 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/058c8666 Branch: refs/heads/master Commit: 058c86661368766a7b7804314824d12d2f325f58 Parents: d0fbf73 Author: Andrea Cosentino <[email protected]> Authored: Wed Jan 27 13:21:55 2016 +0100 Committer: Andrea Cosentino <[email protected]> Committed: Wed Jan 27 13:21:55 2016 +0100 ---------------------------------------------------------------------- .../camel-base64/src/main/docs/base64.adoc | 116 +++++++++++++++++++ docs/user-manual/en/SUMMARY.md | 1 + 2 files changed, 117 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/058c8666/components/camel-base64/src/main/docs/base64.adoc ---------------------------------------------------------------------- diff --git a/components/camel-base64/src/main/docs/base64.adoc b/components/camel-base64/src/main/docs/base64.adoc new file mode 100644 index 0000000..4931808 --- /dev/null +++ b/components/camel-base64/src/main/docs/base64.adoc @@ -0,0 +1,116 @@ +[[Base64-Base64DataFormat]] +Base64 Data Format +~~~~~~~~~~~~~~~~~~ + +*Available as of Camel 2.11* + + The Base64 link:data-format.html[Data Format] is a data format for +http://en.wikipedia.org/wiki/Base64[base64 encoding and decoding]. + +[[Base64-Options]] +Options +^^^^^^^ + +[width="100%",cols="10%,10%,80%",options="header",] +|======================================================================= +|Option |Default |Description + +|lineLength |76 |To specific a maximum line length for the encoded data. + +|lineSeparator |\r\n |The line separators to use. + +|urlSafe |`false` |Instead of emitting '+' and '/' we emit '-' and '_' respectively. +urlSafe is only applied to encode operations. Decoding seamlessly +handles both modes. +|======================================================================= + +In Spring DSL, you configure the data format using this tag: + +[source,xml] +-------------------------------------------------------------------------------------------------------- +<camelContext> + <dataFormats> + <!-- for a newline character (\n), use the HTML entity notation coupled with the ASCII code. --> + <base64 lineSeparator=" " id="base64withNewLine" /> + <base64 lineLength="64" id="base64withLineLength64" /> + </dataFormats> + ... +</camelContext> +-------------------------------------------------------------------------------------------------------- + +Then you can use it later by its reference: + +[source,xml] +--------------------------------------------- +<route> + <from uri="direct:startEncode" /> + <marshal ref="base64withLineLength64" /> + <to uri="mock:result" /> +</route> +--------------------------------------------- + +Most of the time, you won't need to declare the data format if you use +the default options. In that case, you can declare the data format +inline as shown below. + +[[Base64-Marshal]] +Marshal +^^^^^^^ + +In this example we marshal the file content to base64 object. + +[source,java] +--------------------------------------------------------------- +from("file://data.bin").marshal().base64().to("jms://myqueue"); +--------------------------------------------------------------- + +In Spring DSL: + +[source,xml] +----------------------------- + <from uri="file://data.bin"> + <marshal> + <base64/> + </marshal> + <to uri="jms://myqueue"/> +----------------------------- + +[[Base64-Unmarshal]] +Unmarshal +^^^^^^^^^ + +In this example we unmarshal the payload from the JMS queue to a byte[] +object, before its processed by the newOrder processor. + +[source,java] +---------------------------------------------------------------------- +from("jms://queue/order").unmarshal().base64().processRef("newOrder"); +---------------------------------------------------------------------- + +In Spring DSL: + +[source,xml] +------------------------------- + <from uri="jms://queue/order"> + <marshal> + <base64/> + </marshal> + <to uri="bean:newOrder"/> +------------------------------- + +[[Base64-Dependencies]] +Dependencies +^^^^^^^^^^^^ + +To use Base64 in your Camel routes you need to add a dependency on +*camel-base64* which implements this data format. + +If you use Maven you can just add the following to your pom.xml: + +[source,xml] +------------------------------------------------------------------------------------ +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-base64</artifactId> + <version>x.x.x</version> <!-- use the same version as your Camel core version --> +</dependency> +------------------------------------------------------------------------------------ http://git-wip-us.apache.org/repos/asf/camel/blob/058c8666/docs/user-manual/en/SUMMARY.md ---------------------------------------------------------------------- diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md index 820ef82..3ffac29 100644 --- a/docs/user-manual/en/SUMMARY.md +++ b/docs/user-manual/en/SUMMARY.md @@ -90,6 +90,7 @@ * [AWS SWF](aws-swf.adoc) * [Bam](bam.adoc) * [Barcode](barcode-data-format.adoc) + * [Base64](base64.adoc) * [CDI](cdi.adoc) * [JMS](jms.adoc) * [Metrics](metrics.adoc)
