Hello Anoop,
you can use FormDataMultiPart class, see
http://jersey.java.net/nonav/apidocs/latest/contribs/jersey-multipart/com/sun/jersey/multipart/FormDataMultiPart.html
these two examples are equal:
a) @FormDataParam:
@POST
@Path("theService")
@Consumes("multipart/form-data")
public String theService(@FormDataParam("schema") final String schema)
throws Exception
{
System.out.println("### " + schema);
return ...
}
b) FromDataMultiPart
@POST
@Path("theService")
@Consumes("multipart/form-data")
public String theService(FormDataMultiPart formDataMultiPart)
throws Exception
{
System.out.println("### " +
formDataMultiPart.getField("schema").getValue());
return ...
}
Regards,
Pavel
On 5/3/11 1:20 PM, Anoop R wrote:
> Greetings,
>
> What is the best way to read form parameters in a POST request send to
> a RESTful service? I tried using @FormParam annotation and it works
> fine. But the number of arguments will keep on increasing as the
> number of form elements increases. For GET request I can use UriInfo
> and MultiValuedMap to get all request params in one shot. Is there a
> way to get it done in the same way for POST requests?
>
> Thanks in Advance.
>
> Anoop