private static String buildMessage(Response response) throws IOException { String message = response.getRequestLine().getMethod() + " " + response.getHost() + response.getRequestLine().getUri() + ": " + response.getStatusLine().toString(); HttpEntity entity = response.getEntity(); if (entity != null) { if (entity.isRepeatable() == false) { entity = new BufferedHttpEntity(entity); response.getHttpResponse().setEntity(entity); } message += "\n" + EntityUtils.toString(entity); } return message; }
private static String buildMessage(Response response) throws IOException { String message = String.format(Locale.ROOT, "method [%s], host [%s], URI [%s], status line [%s]", response.getRequestLine().getMethod(), response.getHost(), response.getRequestLine().getUri(), response.getStatusLine().toString() ); HttpEntity entity = response.getEntity(); if (entity != null) { if (entity.isRepeatable() == false) { entity = new BufferedHttpEntity(entity); response.getHttpResponse().setEntity(entity); } message += "\n" + EntityUtils.toString(entity); } return message; }
private static String buildMessage(Response response) throws IOException { String message = String.format(Locale.ROOT, "method [%s], host [%s], URI [%s], status line [%s]", response.getRequestLine().getMethod(), response.getHost(), response.getRequestLine().getUri(), response.getStatusLine().toString() ); if (response.hasWarnings()) { message += "\n" + "Warnings: " + response.getWarnings(); } HttpEntity entity = response.getEntity(); if (entity != null) { if (entity.isRepeatable() == false) { entity = new BufferedHttpEntity(entity); response.getHttpResponse().setEntity(entity); } message += "\n" + EntityUtils.toString(entity); } return message; }