private void dumpRequest(final HttpServletRequestLoggingWrapper request, final int id) {
        final StringWriter stringWriter = new StringWriter();
        final PrintWriter printWriter = new PrintWriter(stringWriter);
        if ((request.getRemoteUser() == null) || (request.getRemoteUser().trim().length() == 0)) {
            printWriter.print("Not authenticated");
        } else {
            printWriter.print("Authenticated as ");
            printWriter.println(request.getRemoteUser());
        }
        printWriter.print("-- ID: ");
        printWriter.println(id);
        printWriter.print(request.getMethod());
        printWriter.print(" ");
        printWriter.print(request.getRequestURL());
        printWriter.print(" ");
        printWriter.println(request.getProtocol());
        if (LOG_HEADERS.isDebugEnabled()) {
            @SuppressWarnings("unchecked")
            final Enumeration<String> headerNames = request.getHeaderNames();
            while (headerNames.hasMoreElements()) {
                final String key = headerNames.nextElement();
                @SuppressWarnings("unchecked")
                final Enumeration<String> headerValues = request.getHeaders(key);
                printWriter.print(key);
                printWriter.print(": ");
                while (headerValues.hasMoreElements()) {
                    printWriter.print(headerValues.nextElement());
                    printWriter.println();
                    if (headerValues.hasMoreElements()) {
                        printWriter.print(' ');
                    }
                }
            }
        }
        printWriter.println("-- Begin request body");
        final String body = request.getBody();
        if (body == null || body.length() == 0) {
            printWriter.println("-- NO BODY FOUND IN REQUEST");
        } else {
            printWriter.println(body);
        }
        printWriter.println("-- End request body");
        printWriter.flush();
        LOG_REQUEST.debug(stringWriter.toString());
    }
private void dumpRequest ( final HttpServletRequestLoggingWrapper request , final int id ) { final StringWriter stringWriter = new StringWriter ( ) ; final PrintWriter printWriter = new PrintWriter ( stringWriter ) ; if ( ( request . getRemoteUser ( ) == null ) || ( request . getRemoteUser ( ) . trim ( ) . length ( ) == 0 ) ) { printWriter . print ( "Not authenticated" ) ; } else { printWriter . print ( "Authenticated as " ) ; printWriter . println ( request . getRemoteUser ( ) ) ; } printWriter . print ( "-- ID: " ) ; printWriter . println ( id ) ; printWriter . print ( request . getMethod ( ) ) ; printWriter . print ( " " ) ; printWriter . print ( request . getRequestURL ( ) ) ; printWriter . print ( " " ) ; printWriter . println ( request . getProtocol ( ) ) ; if ( LOG_HEADERS . isDebugEnabled ( ) ) { @ SuppressWarnings ( "unchecked" ) final Enumeration < String > headerNames = request . getHeaderNames ( ) ; while ( headerNames . hasMoreElements ( ) ) { final String key = headerNames . nextElement ( ) ; @ SuppressWarnings ( "unchecked" ) final Enumeration < String > headerValues = request . getHeaders ( key ) ; printWriter . print ( key ) ; printWriter . print ( ": " ) ; while ( headerValues . hasMoreElements ( ) ) { printWriter . print ( headerValues . nextElement ( ) ) ; printWriter . println ( ) ; if ( headerValues . hasMoreElements ( ) ) { printWriter . print ( ' ' ) ; } } } } printWriter . println ( "-- Begin request body" ) ; final String body = request . getBody ( ) ; if ( body == null || body . length ( ) == 0 ) { printWriter . println ( "-- NO BODY FOUND IN REQUEST" ) ; } else { printWriter . println ( body ) ; } printWriter . println ( "-- End request body" ) ; printWriter . flush ( ) ; LOG_REQUEST . debug ( stringWriter . toString ( ) ) ; }
This method handles the dumping of the request body, method, URL and headers if needed

@param request RequestWrapper used to handle the request by the webapp
@param id      Generated unique identifier for the request/response couple