users@jersey.java.net

[Jersey] Re: Curl, Jersey and InFormParam multi valued map.

From: Rahul Babbar <rahul.babbar1_at_gmail.com>
Date: Tue, 29 Mar 2011 10:23:14 -0700

Any comments!!!

Rahul


On Mon, Mar 28, 2011 at 11:17 AM, Rahul Babbar <rahul.babbar1_at_gmail.com>wrote:

> Hello all,
>
> I have the following piece of code.
>
>
> @POST
> @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
> public Response doAction(MultivaluedMap<String, String> inFormParams) {
> String action = inFormParams.getFirst("action");
>
> Response response = null;
> if(StringUtils.isEmpty(action)) {
> throw new UnrecoverableException("Unexpected null or empty action");
> }
> // do something...
> return response;
> }
>
>
> And i post using the following command from Curl
>
> curl --data "action=updateCache" http://$USER:$PASSWORD@localhost
> :8080/<URI>
>
> both inFormParams and action are empty.
>
> What am i doing wrong? How can i get the post parameters in a map?
>
> Thank you.
>
> Rahul
>