private String getResponseBody()

in src/main/java/org/apache/sling/discovery/base/connectors/ping/TopologyRequestValidator.java [571:586]


    private String getResponseBody(HttpResponse response) throws IOException {
        final Header contentEncoding = response.getFirstHeader("Content-Encoding");
        if (contentEncoding!=null && contentEncoding.getValue()!=null &&
                contentEncoding.getValue().contains("gzip")) {
            // then the server sent gzip - treat it so:
            final GZIPInputStream gzipIn = new GZIPInputStream(response.getEntity().getContent());
            try {
                return IOUtils.toString(gzipIn);
            } finally {
                gzipIn.close();
            }
        } else {
        	// otherwise the server sent plaintext:
        	return IOUtils.toString(response.getEntity().getContent(), "UTF-8");
        }
    }