users@jersey.java.net

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

From: Rahul Babbar <rahul.babbar1_at_gmail.com>
Date: Mon, 28 Mar 2011 11:17:13 -0700

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