users@jersey.java.net

[Jersey] Handling list of entity providers with _at_PUT

From: Shane Perry <thrykol_at_gmail.com>
Date: Tue, 22 Oct 2013 06:59:26 -0600

I can't seem to figure out how to retrieve a list of entity providers when
using MediaType.MULTIPART_FORM_DATA. In the example below, test1 throws a
nasty validation error while test2 works. Ultimately I need to use my own
entity provider which I've figured out in general and while the test
doesn't reflect it I am also receiving files (thus the MediaType).

@PUT
@Path("/test1")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response test1(@FormDataParam("param0") String param0,
@FormDataParam("param1") final List<String> param1)
{
  return Response.ok().build();
}

@PUT
@Path("/test2")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response test2(@FormParam("param0") String param0,
@FormParam("param1") final List<String> param1)
{
  return Response.ok().build();
}

Any help would be great. Due to a third party dependency I'm currently
using Jersey 2.1 though if necessary I could patch the third party
dependency.

Thanks in advance,

Shane