HttpClient httpRequest = new HttpClient();
httpRequest.getHttpConnectionManager().getParams().setConnectionTimeout(10000);
httpRequest.getHttpConnectionManager().getParams().setSoTimeout(10000);
String url = NEWS_URL + "?access_token=" + accessToken;
PostMethod postMethod = new PostMethod(url);
JSONObject jsonParams = new JSONObject();
jsonParams.put("type", "news");
jsonParams.put("offset", offset);
jsonParams.put("count", NEWS_COUNT);
String toJson = jsonParams.toString();
RequestEntity se = new StringRequestEntity(toJson, "application/json", "UTF-8");
postMethod.setRequestEntity(se);
postMethod.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
int status = httpRequest.executeMethod(postMethod);
if (status == HttpStatus.SC_OK) {
String json = postMethod.getResponseBodyAsString(); // 把输入流转换成字符数组
json = new String(json.getBytes("ISO-8859-1"), "UTF-8");
JSONTokener jsonParser = new JSONTokener(json);
}