java - Using the jersey client to do a POST operation with request params and a request body -
java - Using the jersey client to do a POST operation with request params and a request body -
i'm trying figure how how utilize bailiwick of jersey client send both request params , request body of post operation.
currently know how both of way individually, not together.
from here: using bailiwick of jersey client post operation
i've gotten request parms:
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 request body can following:
string jsonobject ="... valid json object"; webresource.type(mediatype.application_json_type).post(string.class, jsonobject);
how post both request param request body?
thanks
i figured out..
webresource.queryparam("key", "value").type(mediatype.application_json_type).post(string.class, jsonobject);
java java-ee jersey
Comments
Post a Comment