-
- private static String readHttpResponse(HttpResponse httpResponse)
- throws ParseException, IOException {
- StringBuilder builder = new StringBuilder();
- HttpEntity entity = httpResponse.getEntity();
- builder.append("status:" + httpResponse.getStatusLine());
- builder.append("headers:");
- HeaderIterator iterator = httpResponse.headerIterator();
- while (iterator.hasNext()) {
- builder.append("\t" + iterator.next());
- }
- if (entity != null) {
- String responseString = EntityUtils.toString(entity);
- builder.append("response length:" + responseString.length());
- builder.append("response content:" + responseString.replace("\r\n", ""));
- }
- return builder.toString();
- }