Network Deployment (Distributed operating systems), v8.0 > End-to-end paths > Web services - RESTful services


 Using multipart content in JAX-RS application requests and responses

Use 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. JAX-WS

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. We can instantiate one of the multipart classes and add individual parts to the multipart data model. We 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.



Related tasks

Implement resources using multipart messages
Use multipart/form-data content in JAX-RS application requests and responses









+

Search Tips   |   Advanced Search