224.4. 例子
from(...).marshal().mimeMultipart()
当没有设置 Content-Type 标头的消息后,将创建一个带有以下消息 Camel 标头的消息:
Camel Message Headers
Content-Type=multipart/mixed; \n boundary="----=_Part_0_14180567.1447658227051" Message-Id=<...> MIME-Version=1.0
The message body will be:
Camel 消息正文
------=_Part_0_14180567.1447658227051 Content-Type: application/octet-stream Content-Transfer-Encoding: base64 Qm9keSB0ZXh0 ------=_Part_0_14180567.1447658227051 Content-Type: application/binary Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="Attachment File Name" AAECAwQFBgc= ------=_Part_0_14180567.1447658227051--
发送到路由的标头 Content-Type 设置为 "text/plain" 的消息
from("...").marshal().mimeMultipart("related", true, true, "(included|x-.*)", true);
将创建一个消息,但没有将任何特定的 MIME 标头设置为 Camel 标头(从 Camel 消息中删除 Content-Type 标头),以及包含以 "x-" 开头的原始消息的所有标头以及名为 "included" 的标头:
Camel 消息正文
Message-ID: <...> MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_0_1134128170.1447659361365" x-bar: also there included: must be included x-foo: any value ------=_Part_0_1134128170.1447659361365 Content-Type: text/plain Content-Transfer-Encoding: 8bit Body text ------=_Part_0_1134128170.1447659361365 Content-Type: application/binary Content-Transfer-Encoding: binary Content-Disposition: attachment; filename="Attachment File Name" [binary content] ------=_Part_0_1134128170.1447659361365