Using multipart content in JAX-RS application requests and responses

Using multipart messages, servers and clients can transmit multiple messages using a single message. Multipart messages are useful when both the client and server need to send multiple requests but want to save the cost of sending and receiving entire HTTP request and responses for each part.

About this task

Multipart messages require special message formatting to send content for multiple messages content in a single message. IBM® JAX-RS provides classes to represent the multipart data model that can help read and write multipart messages. System registered default JAX-RS entity providers can serialize and deserialize the classes into message bodies. You can instantiate one of the multipart classes and add individual parts to the multipart data model. You can then return the multipart instance in a resource method and have the JAX-RS runtime environment automatically format and output the multipart message.

If you specifically need to use multipart/form-data content, refer to the "Using multipart/form-data content in JAX-RS application requests and responses" section.

Procedure

  1. Configure the development environment.
  2. Define the resources in JAX-RS web applications.
  3. Configure the JAX-RS application.
  4. Implement a resource using multipart messages
  5. Assemble JAX-RS web applications.
  6. Deploy JAX-RS web applications.

Results

You have developed and deployed a JAX-RS web application on the application server that consumes and produces messages of multiple content types.

Task topic    

Terms and conditions for information centers | Feedback

Last updated: April 18, 2014 05:01 AM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-nd-iseries&topic=twbs_jaxrs_multipartcontent
File name: twbs_jaxrs_multipartcontent.html