private void debug ( final HttpServletRequest request ) { if ( ! logger . isInfoEnabled ( ) ) { logger . warn ( "Logger INTO not enabled!" ) ; return ; } logger . info ( HEADERS ) ; Enumeration headerEnumeration = request . getHeaderNames ( ) ; while ( headerEnumeration . hasMoreElements ( ) ) { String elementName = ( String ) headerEnumeration . nextElement ( ) ; logger . info ( elementName + " = " + request . getHeader ( elementName ) ) ; } logger . info ( ATTRIBUTES ) ; Enumeration attributeEnumeration = request . getAttributeNames ( ) ; while ( attributeEnumeration . hasMoreElements ( ) ) { String elementName = ( String ) attributeEnumeration . nextElement ( ) ; logger . info ( elementName + " = " + request . getAttribute ( elementName ) ) ; } logger . info ( PARAMETERS ) ; Map < String , String [ ] > parameterMap = request . getParameterMap ( ) ; for ( Map . Entry < String , String [ ] > entry : parameterMap . entrySet ( ) ) { StringBuilder parameterValues = new StringBuilder ( ) ; if ( entry . getValue ( ) != null ) for ( String value : entry . getValue ( ) ) { parameterValues . append ( value ) ; parameterValues . append ( ' ' ) ; } logger . info ( entry . getKey ( ) + " = " + parameterValues ) ; } HttpSession session = request . getSession ( false ) ; if ( session != null ) { logger . info ( "Session = " + session . getId ( ) ) ; logger . info ( SESSION_ATTRIBUTES ) ; Enumeration sessionAttrEnumeration = session . getAttributeNames ( ) ; while ( sessionAttrEnumeration . hasMoreElements ( ) ) { String elementName = ( String ) sessionAttrEnumeration . nextElement ( ) ; logger . info ( elementName + " = " + session . getAttribute ( elementName ) ) ; } } logger . info ( "Remote ip = " + request . getRemoteAddr ( ) ) ; logger . info ( "Server name = " + request . getServerName ( ) ) ; logger . info ( "Server port = " + request . getServerPort ( ) ) ; }
Dump out to sysOut request parameters .