FileDocCategorySizeDatePackage
BasicHttpParams.javaAPI DocAndroid 1.5 API5231Wed May 06 22:41:10 BST 2009org.apache.http.params

BasicHttpParams

public final class BasicHttpParams extends AbstractHttpParams implements Serializable, Cloneable
This class represents a collection of HTTP protocol parameters. Protocol parameters may be linked together to form a hierarchy. If a particular parameter value has not been explicitly defined in the collection itself, its value will be drawn from the parent collection of parameters.
author
Oleg Kalnichevski
version
$Revision: 610464 $

Fields Summary
private static final long
serialVersionUID
private HashMap
parameters
Map of HTTP parameters that this collection contains.
Constructors Summary
public BasicHttpParams()


      
        super();
    
Methods Summary
public voidclear()
Removes all parameters from this collection.

        this.parameters = null;
    
public java.lang.Objectclone()

        BasicHttpParams clone = (BasicHttpParams) super.clone();
        copyParams(clone);
        return clone;
    
public org.apache.http.params.HttpParamscopy()
Creates a copy of these parameters. The implementation here instantiates {@link BasicHttpParams}, then calls {@link #copyParams(HttpParams)} to populate the copy.

return
a new set of params holding a copy of the local parameters in this object.

        BasicHttpParams clone = new BasicHttpParams();
        copyParams(clone);
        return clone;
    
protected voidcopyParams(org.apache.http.params.HttpParams target)
Copies the locally defined parameters to the argument parameters. This method is called from {@link #copy()}.

param
target the parameters to which to copy

        if (this.parameters == null)
            return;

        Iterator iter = parameters.entrySet().iterator();
        while (iter.hasNext()) {
            Map.Entry me = (Map.Entry) iter.next();
            if (me.getKey() instanceof String)
                target.setParameter((String)me.getKey(), me.getValue());
        }
    
public java.lang.ObjectgetParameter(java.lang.String name)

        // See if the parameter has been explicitly defined
        Object param = null;
        if (this.parameters != null) {
            param = this.parameters.get(name);
        }    
        return param;
    
public booleanisParameterSet(java.lang.String name)

        return getParameter(name) != null;
    
public booleanisParameterSetLocally(java.lang.String name)

        return this.parameters != null && this.parameters.get(name) != null;
    
public booleanremoveParameter(java.lang.String name)

        if (this.parameters == null) {
            return false;
        }
        //this is to avoid the case in which the key has a null value
        if (this.parameters.containsKey(name)) {
            this.parameters.remove(name);
            return true;
        } else {
            return false;
        }
    
public org.apache.http.params.HttpParamssetParameter(java.lang.String name, java.lang.Object value)

        if (this.parameters == null) {
            this.parameters = new HashMap();
        }
        this.parameters.put(name, value);
        return this;
    
public voidsetParameters(java.lang.String[] names, java.lang.Object value)
Assigns the value to all the parameter with the given names

param
names array of parameter name
param
value parameter value

        for (int i = 0; i < names.length; i++) {
            setParameter(names[i], value);
        }