我有一个HttpPost
请求,我需要为它设置多个实体。我知道setEntity
用于设置单个实体。
ObjectMapper mapper = new ObjectMapper();
String json = "";
json = mapper.writeValueAsString(object);
StringEntity se = new StringEntity(json);
se.setContentType("application/json;charset=UTF-8");
se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,
"application/json;charset=UTF-8"));
request.setEntity(se);
但是如何在请求中设置多个实体?