users@jersey.java.net

[Jersey] Re: get all form parameters programmatic

From: Hingarajiya,Ravi <rhingarajiya_at_gmail.com>
Date: Mon, 6 May 2013 10:57:25 -0700

Hi Mira,

Thanks for the prompt response.

I am using Jersey 1.8.1 library. It is difficult to move from 1.8.1 to 2.0.
Is there any option in Jersey 1.8.1 ?

Thanks,
Ravi



On Mon, May 6, 2013 at 4:43 AM, miroslav fuksa <miroslav.fuksa_at_oracle.com>wrote:

> 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
>
>
>