Пример #1
0
 /**
  * httpClient的GET请求 返回ResponseBody
  *
  * @param url
  * @param paramsMap
  * @return
  * @throws Exception
  */
 public static String get(String url, Map<String, String> paramsMap) throws Exception {
   String result = null;
   HttpClient httpClient = HttpClientUtil.initHttpClient();
   GetMethod getMethod = HttpClientUtil.getMethod(url, paramsMap);
   // 请求成功
   int status = httpClient.executeMethod(getMethod);
   if (status == 200) {
     result = getMethod.getResponseBodyAsString();
   }
   return result;
 }