private String getRequestBody()

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


    private String getRequestBody(HttpServletRequest request) throws IOException {
        final String contentEncoding = request.getHeader("Content-Encoding");
        if (contentEncoding!=null && contentEncoding.contains("gzip")) {
            // then treat the request body as gzip:
            final GZIPInputStream gzipIn = new GZIPInputStream(request.getInputStream());
            try {
                return IOUtils.toString(gzipIn);
            } finally {
                gzipIn.close();
            }
        } else {
            // otherwise assume plain-text:
            return IOUtils.toString(request.getReader());
        }
    }