CXF AttachmentSerializer misses an extra new line before the first attachment
Environment
- JBoss Fuse
- 6.3
Issue
-
Currently, CXF AttachmentSerializer does not write an empty new line between HTTP headers and the first attachment element. For instance:
Content-Type: multipart/related; type="application/xop+xml"; boundary="uuid:c3b56a15-a479-4789-82c9-8a8484cfefb3"; start="<root.message@cxf.apache.org>"; start-info="text/xml" --uuid:c3b56a15-a479-4789-82c9-8a8484cfefb3 Content-Type: application/xop+xml; charset=UTF-8; type="text/xml" Content-Transfer-Encoding: binary Content-ID: <root.message@cxf.apache.org> <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">... -
As per RFC2046, the multipart-body is defined as:
multipart-body := [preamble CRLF] dash-boundary transport-padding CRLF body-part *encapsulation close-delimiter transport-padding [CRLF epilogue]The whole [preamble CRLF] is optional if you do not have anything before the "dash-boundary". Then you do not need an leading CRLF. However, you do need an CRLF in between if the preamble and it's terminating CRLF is there. In this case, it is "Content-Type: multipart/related; ... CRLF", therefore the additional CRLF is not optional anymore:
Content-Type: multipart/related; type="application/xop+xml"; boundary="uuid:c3b56a15-a479-4789-82c9-8a8484cfefb3"; start="<root.message@cxf.apache.org>"; start-info="text/xml" --uuid:c3b56a15-a479-4789-82c9-8a8484cfefb3 Content-Type: application/xop+xml; charset=UTF-8; type="text/xml" Content-Transfer-Encoding: binary Content-ID: <root.message@cxf.apache.org> <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">... -
The issue was fixed in JBoss Fuse 6.0 and 6.1 via the JIRA SF-481. But it was not fixed in JBoss Fuse 6.2.1 and JBoss Fuse 6.3.
Resolution
Upgrade to JBoss Fuse 6.3 R6 when it becomes available.
Root Cause
It was caused by the JIRA ENTESB-7374.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
