HttpClient的使用(3)
来源:未知 责任编辑:责任编辑 发表时间:2014-04-20 03:36 点击:次
* 问卷id,作为从盖娅系统中获取调查问卷的参数
* </pre>
*/
private Map<String, String> questionTypeToQuestionId = new HashMap<String, String>();
private HttpClient httpClient;
public boolean addFeedBack(FeedBackModel feedBackModel) {
if (feedBackModel == null) {
return false;
}
boolean res = false;
// 调用盖娅系统的接口,提交反馈
PostMethod postMethod = new PostMethod(feedBackAnswerUrl);
postMethod.addParameter(PARAM_QUESTION_ID, feedBackModel.getQuestionId());
postMethod.addParameter(PARAM_ANSWER, feedBackModel.getAnswer());
postMethod.addParameter(PARAM_COOKIE_ID, feedBackModel.getCookieId());
try {
int statusCode = httpClient.executeMethod(postMethod);
if (statusCode != HttpStatus.SC_OK) {
StringBuilder sb = new StringBuilder("fail to add feedback, requestUrl=");
sb.append(feedBackAnswerUrl).append(", parameter: ").append(feedBackModel.toString()).append(", HTTP StatusCode=").append(statusCode);
log.error(sb.toString());
res = false;
} else {
res = true;
}
} catch (HttpException e) {
log.error("HttpException occured when addFeedBack, requestUrl=" + feedBackAnswerUrl + ", parameter: " + feedBackModel.toString(), e);
res = false;
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>