private void dumpResponse(final HttpServletResponseLoggingWrapper response, final int id) {
        final StringWriter stringWriter = new StringWriter();
        final PrintWriter printWriter = new PrintWriter(stringWriter);
        printWriter.print("-- ID: ");
        printWriter.println(id);
        printWriter.println(response.getStatusCode());
        if (LOG_HEADERS.isDebugEnabled()) {
            final Map<String, List<String>> headers = response.headers;
            for (Map.Entry<String, List<String>> header : headers.entrySet()) {
                printWriter.print(header.getKey());
                printWriter.print(": ");
                Iterator<String> values = header.getValue().iterator();
                while (values.hasNext()) {
                    printWriter.print(values.next());
                    printWriter.println();
                    if (values.hasNext()) {
                        printWriter.print(' ');
                    }
                }
            }
        }
        printWriter.println("-- Begin response body");

        final String body = response.getContentAsInputString();
        if (body == null || body.length() == 0) {
            printWriter.println("-- NO BODY WRITTEN IN RESPONSE");
        } else {
            printWriter.println(body);
        }
        printWriter.println();
        printWriter.println("-- End response body");
        printWriter.flush();
        LOG_RESPONSE.debug(stringWriter.toString());
    }