A multipart message contains one or more other messages within its structure. Each message part can have its own content type. Using IBM® Java API for RESTful Web Services (JAX-RS), you can produce and consume multipart messages.
IBM JAX-RS provides classes from Apache Wink to model a multipart request and a multipart response. Additionally, IBM JAX-RS includes entity providers, by default, that support multipart messages. These entity providers can serialize and deserialize the multipart class instances when the message content type is compatible with multipart/*.
To process multipart messages using Apache Wink APIs, you must use defined classes to represent the multipart message body entity.
org.apache.wink.common.model.multipart.InMultiPart org.apache.wink.common.model.multipart.BufferedInMultiPart
Use one of the incoming multipart request class types as a method parameter in your resource method. The InMultiPart class streams the request message whereas the BufferedInMultiPart class stores the entire message in memory. Streaming the message consumes less memory but you can only access the message parts once in an iterative manner. In contrast, by using buffering, you can read any part of the message at any time.
org.apache.wink.common.model.multipart.OutMultiPart org.apache.wink.common.model.multipart.BufferedOutMultiPart
You can return an instance of one of the outbound multipart response types in your resource method. The OutMultiPart class streams the multipart response whereas the BufferedOutMultiPart class stores the entire message in memory.
These multipart inbound and outbound classes use JAX-RS entity providers to serialize and deserialize individual parts of the multipart message.
To learn more about the multipart message classes, see the Apache Wink API documentation.
You can receive and send multipart messages containing multiple content types.
In this information ... | IBM Redbooks, demos, education, and more(Index) |