This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit b7ede17b1893bad0bc7aa1c00829357f061d7dd9 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon Aug 26 05:33:21 2019 +0200 Add missing docs --- .../src/main/docs/attachments.adoc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/components/camel-attachments/src/main/docs/attachments.adoc b/components/camel-attachments/src/main/docs/attachments.adoc new file mode 100644 index 0000000..85dcbce --- /dev/null +++ b/components/camel-attachments/src/main/docs/attachments.adoc @@ -0,0 +1,22 @@ += Attachments Component + +The attachments component provides the `javax.attachments` API support for Apache Camel. +A few Camel component uses attachments such as mail and web-service components. +The attachments component is include automatic when using these components. + +The attachments support is on Camel `Message` level, for example to get +the `javax.activation.DataHandler` instance of the attachment, you can do as shown below: + +[source,java] +---- +AttachmentMessage attMsg = exchange.getIn(AttachmentMessage.class); +Attachment attachment = attMsg.getAttachmentObject("myAttachment"); +DataHandler dh = attachment.getDataHandler(); +---- + +And if you want to add an attachment, to a Camel `Message` you can do as shown: +[source,java] +---- +AttachmentMessage attMsg = exchange.getIn(AttachmentMessage.class); +attMsg.addAttachment("message1.xml", new DataHandler(new FileDataSource(new File("myMessage1.xml")))); +----