String doHttpPut(String rpmName, String cookie) throws UnsupportedEncodingException, IOException, ClientProtocolException, Exception {
HttpPut httpPut = new HttpPut(postURI);

System.out.println("**********************");
httpPut.setHeader("Cookie", cookie);
httpPut.setHeader("Content-Type", "application/json;charset=UTF-8");
httpPut.setEntity(getParamaters(rpmName));

HttpResponse response = getHttpClient().execute(httpPut);
HttpEntity entity = response.getEntity();
String html = EntityUtils.toString(entity);
return html;
}

private StringEntity getParamaters(String rpmName) throws UnsupportedEncodingException {

String componentName = getComName(rpmName);

JSONObject parms = new JSONObject();

parms.put("ffff", componentName);

noChange(parms);

JSONObject subParams = new JSONObject();
subParams.put("ss", componentName);

parms.put("properties", subParams);

String jsonString = parms.toString();
System.out.println(jsonString);

return new StringEntity(jsonString, ContentType.APPLICATION_JSON);
}

posted on 2017-03-10 08:41  wblade  阅读(328)  评论(0编辑  收藏  举报