|
From: ujay68 <uj...@gm...> - 2011-06-22 14:57:45
|
Hi,
how do I parameterize an interface method for a POST call that
consumes a multipart/form-data, for use with use
org.jboss.resteasy.client.ProxyFactory?
The server implements something like this:
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
@Path("wherever")
public Response doFooImpl(MultipartFormDataInput object) {
List<InputPart> items = object.getFormDataMap().get("ITEM"); /* ... */
}
In the client, I tried this:
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
@Path("wherever")
Object doFoo(Map<String, DataSource> parts);
But when I run this, the client throws a
java.lang.RuntimeException: could not find writer for content-type
multipart/form-data type: java.util.Map
Would it be better to use a javax.mail.Multipart as a client-side
parameter? Or org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInputImpl
(if that is an "official" API class)?
Thanks, Jay
|