FileDocCategorySizeDatePackage
RFC2617Scheme.javaAPI DocAndroid 1.5 API4188Wed May 06 22:41:10 BST 2009org.apache.http.impl.auth

RFC2617Scheme

public abstract class RFC2617Scheme extends AuthSchemeBase
Abstract authentication scheme class that lays foundation for all RFC 2617 compliant authetication schemes and provides capabilities common to all authentication schemes defined in RFC 2617.
author
Oleg Kalnichevski

Fields Summary
private Map
params
Authentication parameter map.
Constructors Summary
public RFC2617Scheme()
Default constructor for RFC2617 compliant authetication schemes.

        super();
    
Methods Summary
public java.lang.StringgetParameter(java.lang.String name)
Returns authentication parameter with the given name, if available.

param
name The name of the parameter to be returned
return
the parameter with the given name

        if (name == null) {
            throw new IllegalArgumentException("Parameter name may not be null"); 
        }
        if (this.params == null) {
            return null;
        }
        return this.params.get(name.toLowerCase(Locale.ENGLISH));
    
protected java.util.MapgetParameters()
Returns authentication parameters map. Keys in the map are lower-cased.

return
the map of authentication parameters

        if (this.params == null) {
            this.params = new HashMap<String, String>();
        }
        return this.params;
    
public java.lang.StringgetRealm()
Returns authentication realm. The realm may not be null.

return
the authentication realm

        return getParameter("realm");
    
protected voidparseChallenge(org.apache.http.util.CharArrayBuffer buffer, int pos, int len)

        HeaderValueParser parser = BasicHeaderValueParser.DEFAULT;
        ParserCursor cursor = new ParserCursor(pos, buffer.length()); 
        HeaderElement[] elements = parser.parseElements(buffer, cursor);
        if (elements.length == 0) {
            throw new MalformedChallengeException("Authentication challenge is empty");
        }
        
        this.params = new HashMap<String, String>(elements.length);
        for (HeaderElement element : elements) {
            this.params.put(element.getName(), element.getValue());
        }