@Override
    public void setHeader(HeaderKeys key, String value) {
        if (null == key || null == value) {
            throw new IllegalArgumentException("Null input provided");
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "setHeader(h,s): " + key.getName());
        }
        if (this.bHeaderValidation) {
            if (getCharacterValidation()) //PI45266
                value = getValidatedCharacters(value); //PI57228
            else
                checkHeaderValue(value);
        }
        // check validity of the new value first
        if (key.useFilters()) {
            // if this header already exists, then wipe out existing values and
            // make sure the new one is allowed.
            HeaderElement elem = findHeader(key);
            if (null != elem) {
                filterRemove(key, null);
            }
            if (!filterAdd(key, GenericUtils.getEnglishBytes(value))) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "New value disallowed: " + value);
                }
                // we can't reset every value so clean it out
                if (null != elem) {
                    removeHdrInstances(elem, FILTER_NO);
                }
                return;
            }
        }
        HeaderElement elem = findHeader(key);
        if (null != elem) {
            // delete all secondary instances first
            if (null != elem.nextInstance) {
                HeaderElement temp = elem.nextInstance;
                while (null != temp) {
                    temp.remove();
                    temp = temp.nextInstance;
                }
            }
            if (HeaderStorage.NOTSET != this.headerChangeLimit) {
                // parse buffer reuse is enabled, see if we can use existing obj
                if (value.length() <= elem.getValueLength()) {
                    this.headerChangeCount++;
                    elem.setStringValue(value);
                } else {
                    elem.remove();
                    elem = null;
                }
            } else {
                // parse buffer reuse is disabled
                elem.setStringValue(value);
            }
        }
        if (null == elem) {
            // either it didn't exist or we chose not to re-use the object
            elem = getElement(key);
            elem.setStringValue(value);
            addHeader(elem, FILTER_NO);
        } else if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Replacing header " + key.getName() + " [" + elem.getDebugValue() + "]");
        }
    }
@ Override public void setHeader ( HeaderKeys key , String value ) { if ( null == key || null == value ) { throw new IllegalArgumentException ( "Null input provided" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "setHeader(h,s): " + key . getName ( ) ) ; } if ( this . bHeaderValidation ) { if ( getCharacterValidation ( ) ) value = getValidatedCharacters ( value ) ; else checkHeaderValue ( value ) ; } if ( key . useFilters ( ) ) { HeaderElement elem = findHeader ( key ) ; if ( null != elem ) { filterRemove ( key , null ) ; } if ( ! filterAdd ( key , GenericUtils . getEnglishBytes ( value ) ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "New value disallowed: " + value ) ; } if ( null != elem ) { removeHdrInstances ( elem , FILTER_NO ) ; } return ; } } HeaderElement elem = findHeader ( key ) ; if ( null != elem ) { if ( null != elem . nextInstance ) { HeaderElement temp = elem . nextInstance ; while ( null != temp ) { temp . remove ( ) ; temp = temp . nextInstance ; } } if ( HeaderStorage . NOTSET != this . headerChangeLimit ) { if ( value . length ( ) <= elem . getValueLength ( ) ) { this . headerChangeCount ++ ; elem . setStringValue ( value ) ; } else { elem . remove ( ) ; elem = null ; } } else { elem . setStringValue ( value ) ; } } if ( null == elem ) { elem = getElement ( key ) ; elem . setStringValue ( value ) ; addHeader ( elem , FILTER_NO ) ; } else if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Replacing header " + key . getName ( ) + " [" + elem . getDebugValue ( ) + "]" ) ; } }
@see com.ibm.wsspi.genericbnf.HeaderStorage#setHeader(HeaderKeys, String)