9월 10, 2017 1:26:12 오후 org.apache.commons.httpclient.HttpMethodBase getResponseBody
경고: Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
postMethod = new PostMethodUTF8(url);
postMethod.setRequestBody(data);
int responseCode = httpClient.executeMethod(postMethod);
if(responseCode!=200){
rmap.put("result", "NG");
rmap.put("code", String.valueOf(responseCode));
rmap.put("msg", "responseCode is " + responseCode);
return rmap;
}
responseBody = postMethod.getResponseBodyAsString();
ObjectMapper mapper = new ObjectMapper();
rmap = mapper.readValue(responseBody, Map.class);
postMethod = new PostMethodUTF8(url);
postMethod.setRequestBody(data);
int responseCode = httpClient.executeMethod(postMethod);
if(responseCode!=200){
rmap.put("result", "NG");
rmap.put("code", String.valueOf(responseCode));
rmap.put("msg", "responseCode is " + responseCode);
return rmap;
}
InputStream is = postMethod.getResponseBodyAsStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line;
while((line=br.readLine()) != null) {
sb.append(line);
}
br.close();
ObjectMapper mapper = new ObjectMapper();
rmap = mapper.readValue(sb.toString(), Map.class);