223.4. 예제

from(...).marshal().mimeMultipart()

Content-Type 헤더가 설정되지 않은 메시지가 있으면 은 다음과 같은 메시지 Camel 헤더를 사용하여 메시지를 생성합니다.

Camel Message 헤더

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 헤더로 설정된 특정 MIME 헤더(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