THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
Span | ||
---|---|---|
| ||
JAX-RS : Support for Multiparts |
Table of Contents |
---|
Reading attachments
...
Code Block | ||||
---|---|---|---|---|
| ||||
WebClient client = WebClient.create("http://books");t
client.type("multipart/form-data");
ContentDisposition cd = new ContentDisposition("attachment;filename=image.jpg");
Attachment att = new Attachment("root", imageInputStream, cd);
client.post(new MultipartBody(att));
// or just post the attachment if it's a single part request only
client.post(att);
// or just use a file
client.post(getClass().getResource("image.png").getFile());
|
...
Note that once a request has more than two parts then one needs to start using @Mutipart@Multipart, the values can refer to either ContentId header or to ContentDisposition/name. Note that at the moment using @Multipart is preferred to using @FormParam unless a plain name/value submission is dealt with. The reason is that @Multipart can also specify an expected media type of the individual part and thus act similarly to a @Consume annotation.
...