Uploading files are one of the most important aspects of RESTful services. Embedding file contents as binary data within an HTTP request that is text-based is supported using multi-part requests. As the name suggests, a multi-part request is a request containing many parts; some of the parts are text, and others may include binary data. The internal details of multi-part requests are out of the scope of this book. However, you can Google HTTP Multi-Part to learn more about the internals of HTTP multi-part requests.
To use multi-part requests within your Jersey application, you should first include a multi-part support library within your application by adding the following dependency in your project's pom.xml
file:
<dependency> <groupId>org.glassfish.jersey.media</groupId> <artifactId>jersey-media-multipart</artifactId> <version>2.26</version> </dependency>
Then, you should register MultiPartFeature
to your Jersey...