I'm trying to gather all parameters of an HTTP POST request into a map, however it's not working.
With a GET, I used:
@Context
private HttpServletRequest request;
and
@GET
@Path("/{uuid}/invoke/{method}")
public Response invokeMethod (
@PathParam("uuid") String uuid,
@PathParam("method") String methodz
) {
Map<String, String[]> params = request.getParameterMap();
and it returned the map. However, when sending form data via a POST instead of inline with the URL, the map is being returned as NULL.
Is there a similar way to retrieve all the parameters at once using a POST?
EDIT:
My data is being submitted as a serialized JSON, so using a cURL statement as an example:
curl --data "firstname=john&lastname=smith" http://localhost:8080/uuid1/apitest/method1
Ideally, I'd want to get a hashmap of something like:
ParamMap["firstname"] = "john"
ParamMap["lastname"] = "smith"
Also, the parameters won't be static, so this cURL:
curl --data "job=construction" http://localhost:8080/uuid2/apitest/method2
would result in:
ParamMap["job"] = "construction"