I\'ve got an app that\'s basically a proxy to a service. The app itself is built on Jersey and served by Jetty. I have this Resource method:
@POST
@Path(\"/{defa
Three options
@FormParam("<param-name>")
to gt individual params. Ex.
@POST
@Consumes("application/x-www-form-urlencoded")
public Response post(@FormParam("foo") String foo
@FormParam("bar") String bar) {}
Use a MultivaluedMap
to get all the params
@POST
@Consumes("application/x-www-form-urlencoded")
public Response post(MultivaluedMap<String, String> formParams) {
String foo = formParams.getFirst("foo");
}
Use Form
to get all the params.
@POST
@Consumes("application/x-www-form-urlencoded")
public Response post(Form form) {
MultivaluedMap<String, String> formParams = form.asMap();
String foo = formParams.getFirst("foo");
}
Use a @BeanParam
along with individual @FormParam
s to get all the individual params inside a bean.
public class FormBean {
@FormParam("foo")
private String foo;
@FormParam("bar")
private String bar;
// getters and setters
}
@POST
@Consumes("application/x-www-form-urlencoded")
public Response post(@BeanParam FormBean form) {
}