Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Span
stylefont-size:2em;font-weight:bold
JAX-RS : Support for Multiparts

 



Table of Contents

Reading attachments

...

Please see RFC 6266 and this unit test for more information. 

Content-Type

If the content type (Content-Type) of the attachment is not set, it is assumed to be "application/octet-stream". This default could be overridden.

Property
org.apache.cxf.attachment.content-type

The default value for AttachmentDataSource content type in case when "Content-Type" header is not present.

XOP support

CXF JAXRS clients and endpoints can support XML-binary Optimized Packaging (XOP).
What it means at a practical level is that a JAXB bean containing binary data is serialized using a multipart packaging, with the root part containing non-binary data only but also linking to co-located parts containing the actual binary payloads. Next it is deserialized into a JAXB bean on the server side.

If you'd like to experiment with XOP then you need to set an "mtom-enabled" property on CXF jaxrs endpoints and clients.
Please see JAXRSMultipartTest (testXopWebClient) and MultipartStore (addBookXop) for more details.

Multipart Filters

...


It is possible to intercept the attachment write or read process starting from CXF 3.1.12.

...