private void addHeader ( HeaderElement elem , boolean bFilter ) { final HeaderKeys key = elem . getKey ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Adding header [" + key . getName ( ) + "] with value [" + elem . getDebugValue ( ) + "]" ) ; } if ( getRemoteIp ( ) && key . getName ( ) . toLowerCase ( ) . startsWith ( "x-forwarded" ) && ! forwardHeaderErrorState ) { processForwardedHeader ( elem , true ) ; } else if ( getRemoteIp ( ) && key . getName ( ) . toLowerCase ( ) . startsWith ( "forwarded" ) && ! forwardHeaderErrorState ) { processForwardedHeader ( elem , false ) ; } if ( bFilter ) { if ( key . useFilters ( ) && ! filterAdd ( key , elem . asBytes ( ) ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "filter disallowed: " + elem . getDebugValue ( ) ) ; } return ; } } if ( HttpHeaderKeys . isWasPrivateHeader ( key . getName ( ) ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "checking to see if private header is allowed: " + key . getName ( ) ) ; } if ( ! filterAdd ( key , elem . asBytes ( ) ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , key . getName ( ) + " is not trusted for this host; not adding header" ) ; } return ; } } incrementHeaderCounter ( ) ; HeaderElement root = findHeader ( key ) ; boolean rc = addInstanceOfElement ( root , elem ) ; // did we change the root node? if ( rc ) { final int ord = key . getOrdinal ( ) ; storage . put ( ord , elem ) ; } }
Add this new instance of a header to storage .