HttpClient的使用(4)
来源:未知 责任编辑:责任编辑 发表时间:2014-04-20 03:36 点击:次
} catch (IOException e) {
log.error("IOException occured when addFeedBack, requestUrl=" + feedBackAnswerUrl + ", parameter: " + feedBackModel.toString(), e);
res = false;
} finally {
postMethod.releaseConnection();
postMethod = null;
}
return res;
}
public JSONObject getQuestionaire(String questionType) {
String id = questionTypeToQuestionId.get(questionType);
if (StringUtil.isBlank(id)) {
return null;
}
// 调用盖娅系统的接口,获取调查问卷
GetMethod getMethod = new GetMethod(feedBackQuestionaireUrl);
NameValuePair param = new NameValuePair(PARAM_ID, id);
getMethod.setQueryString(new NameValuePair[]{param});
String responseText = null;
try {
// 执行getMethod
int statusCode = httpClient.executeMethod(getMethod);
if (statusCode != HttpStatus.SC_OK) {
StringBuilder sb = new StringBuilder("fail to getQuestionaire, requestUrl=");
sb.append(feedBackQuestionaireUrl).append("?id=").append(id).append(", HTTP StatusCode=").append(statusCode);
log.error(sb.toString());
return null;
}
// 读取内容
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>