When you work on enterprise-grade business applications, often you may want to build RESTful web APIs for reading and writing large binary objects such as images, documents, and various types of media files. Unfortunately, the JAX-RS API does not have standardized APIs for dealing with large binary files. In this section, we will see offerings from the Jersey framework to store and retrieve images files. These APIs are generic in nature and can be used with any large binary file.
Let us build a REST API to store the image sent by the client. We will start with the client and then move on to the server-side implementation.
This example uses an HTML client to upload images to the REST API. When you make a POST
request to the server, you have to encode the data that forms the body of the request. You can use the multipart
/form-data
encoding to deal with a large binary object uploaded via...