Ref:

http://docs.oracle.com/cd/E19776-01/820-4867/ghrst/index.html

http://markmail.org/message/j6mcijemvaeya3ud

http://codahale.com/what-makes-jersey-interesting-parameter-classes/

Best solution:

@POST
@Produces(“text/plain;charset=UTF-8”)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public String form(MultivaluedMap<String, String> formParams) {
System.out.println(“form=” + formParams);
return “”;
}

And below solution is not suggested but can also work:

@POST
@Produces(“text/plain;charset=UTF-8”)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public String form( Form form) {
System.out.println(“form=” + form);
return “”;
}

And below is only working with GET:

@GET
public String get(@Context
HttpServletRequest request, @Context HttpServletResponse resp, @Context UriInfo ui
) {
System.out.println(ui.getQueryParameters());
return “success”;
}

转载请注明:WebLogic Android 博客 » Jersey get all form parameters