Code example for Header

Methods: getName, getValue

0
     */ 
    public void processChallenge(final Header header) throws MalformedChallengeException {
        if (header == null) {
            throw new IllegalArgumentException("Header may not be null");
        } 
        String authheader = header.getName();
        if (authheader.equalsIgnoreCase(AUTH.WWW_AUTH)) {
            this.proxy = false;
        } else if (authheader.equalsIgnoreCase(AUTH.PROXY_AUTH)) {
            this.proxy = true;
        } else { 
            throw new MalformedChallengeException("Unexpected header name: " + authheader);
        } 
 
        CharArrayBuffer buffer;
        int pos;
        if (header instanceof FormattedHeader) {
            buffer = ((FormattedHeader) header).getBuffer();
            pos = ((FormattedHeader) header).getValuePos();
        } else { 
            String s = header.getValue();
            if (s == null) {
                throw new MalformedChallengeException("Header value is null");
            } 
            buffer = new CharArrayBuffer(s.length());
            buffer.append(s);