I am using Jersey 1.8 in my application. I am trying to consume POST
data at the server. The data is of the type application/x-www-form-urlencoded
.
For cases where the Content-Type
is multipart/form-data
, this MultivaluedMap
approach won't work.
Use FormDataMultiPart
- docs here.
Got it. As per this document, I can use a MultivaluedMap<K,V>
or Form to get all the POST data of the type application/x-www-form-urlencoded
in one object. A working exmple:
@POST
@Path("/urienodedeample")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.APPLICATION_JSON)
public Response uriEncodedExample(MultivaluedMap<String,String> multivaluedMap) {
logger.info(multivaluedMap);
return Response.status(200).build();
}