I am trying to understand how to use the Jersey client to send both the request parameters and the request body of the POST operation.
Currently, I know how to do this in both ways individually, but not together.
From here: Using a Jersey client to perform a POST operation
I got this for parms requests:
MultivaluedMap formData = new MultivaluedMapImpl();
formData.add("name1", "val1");
formData.add("name2", "val2");
ClientResponse response = webResource.type("application/x-www-form-urlencoded").post(ClientResponse.class, formData);
And for the request body, I can do the following:
String jsonObject ="... valid json object";
webResource.type(MediaType.APPLICATION_JSON_TYPE).post(String.class, jsonObject);
How to send both request parameters with request body?
thank
source
share