223.4. 例子
from(...).marshal().mimeMultipart()
如果设置了 no Content-Type 标头的消息,将创建一个带有以下消息 Camel 标头的消息:
Camel 消息标头
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);
将创建一个消息,而不设置为 Camel 标头( Content-Type 标头从 Camel 消息中移除)和以下消息正文,其中包含以 "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