dev@jersey.java.net

Re: get all form parameters programmatic

From: miroslav fuksa <miroslav.fuksa_at_oracle.com>
Date: Mon, 06 May 2013 13:43:32 +0200

Hi,

If you speak about Jersey2/JAX-RS 2.0, you can use
"javax.ws.rs.core.Form" and define it as an entity.

For example:
         @POST
         public String post(Form form) {
             ...
         }

Form is an entity parameter. You can then call "form.asMap()" to get map
or form params.

Mira




On 6.5.2013 4:34, Hingarajiya,Ravi wrote:
> I am looking Is there any way to get all form parameters programmatic
> way instead of @FormParam annotation.
> I may not know all Form Parameter key during developing JAXRS REST
> Service. We can't use @FormParam in this situation APIk.
> I can retrieve all query parameters using @Context. I am looking
> similar way to get all form parameters.
>
> @POST
> @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
> @Produces(MediaType.APPLICATION_JSON)
> public String post(@Context UriInfo uriinfo) {
> *MultivaluedMap<String, String> params = uriinfo.getQueryParameters();*
>
> }
>
>
> Thanks,
> Ravi Hingarajiya