FileDocCategorySizeDatePackage
DefaultedHttpContext.javaAPI DocAndroid 1.5 API2840Wed May 06 22:41:10 BST 2009org.apache.http.protocol

DefaultedHttpContext

public final class DefaultedHttpContext extends Object implements HttpContext
{@link HttpContext} implementation that delegates resolution of an attribute to the given default {@link HttpContext} instance if the attribute is not present in the local one. The state of the local context can be mutated, whereas the default context is treated as read-only.
author
Oleg Kalnichevski
version
$Revision: 654882 $

Fields Summary
private final HttpContext
local
private final HttpContext
defaults
Constructors Summary
public DefaultedHttpContext(HttpContext local, HttpContext defaults)

        super();
        if (local == null) {
            throw new IllegalArgumentException("HTTP context may not be null");
        }
        this.local = local;
        this.defaults = defaults;
    
Methods Summary
public java.lang.ObjectgetAttribute(java.lang.String id)

        Object obj = this.local.getAttribute(id);
        if (obj == null) {
            return this.defaults.getAttribute(id);
        } else {
            return obj;
        }
    
public org.apache.http.protocol.HttpContextgetDefaults()

        return this.defaults;
    
public java.lang.ObjectremoveAttribute(java.lang.String id)

        return this.local.removeAttribute(id);
    
public voidsetAttribute(java.lang.String id, java.lang.Object obj)

        this.local.setAttribute(id, obj);