Roman Roman - 1 year ago 177
Android Question

Android annotations REST send image

I use android annotations to communicate with the server. In one of the api calls I need to send some text data and an image, say, from gallery.

String addItem(Protocol protocol);

How do I attach a MultipartForm with an image along with the post request?

Answer Source

Just use the right Spring converter : FormHttpMessageConverter.

However, this converter only accepts MultiValueMap as method parameter. Please have a look at these two issues: #652 and #660.

If you really want to use any object as parameter, you have to implement your own custom FormHttpMessageConverter which will handle that by using reflection.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download