public static void logHttpResponse ( HttpURLConnection conn , OperationContext opContext ) throws IOException { if ( Logger . shouldLog ( opContext , Log . VERBOSE ) ) { try { StringBuilder bld = new StringBuilder ( ) ; // This map's null key will contain the response code and message for ( Map . Entry < String , List < String > > header : conn . getHeaderFields ( ) . entrySet ( ) ) { if ( header . getKey ( ) != null ) { bld . append ( header . getKey ( ) ) ; bld . append ( ": " ) ; } for ( int i = 0 ; i < header . getValue ( ) . size ( ) ; i ++ ) { bld . append ( header . getValue ( ) . get ( i ) ) ; if ( i < header . getValue ( ) . size ( ) - 1 ) { bld . append ( "," ) ; } } bld . append ( ' ' ) ; } Logger . verbose ( opContext , bld . toString ( ) ) ; } catch ( Exception e ) { // Do nothing } } }
Logs the HttpURLConnection response . If an exception is encountered logs nothing .