org.apache.http.params
Class BasicHttpParams

java.lang.Object
  extended by org.apache.http.params.AbstractHttpParams
      extended by org.apache.http.params.BasicHttpParams
All Implemented Interfaces:
java.io.Serializable, HttpLinkedParams, HttpParams

public class BasicHttpParams
extends AbstractHttpParams
implements HttpLinkedParams, java.io.Serializable

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.

Version:
$Revision: 542317 $
Author:
Oleg Kalnichevski
See Also:
Serialized Form

Field Summary
protected  HttpParams defaults
          The optional set of default values to defer to.
 
Constructor Summary
BasicHttpParams()
           
BasicHttpParams(HttpParams defaults)
          Creates a new collection of parameters with the given parent.
 
Method Summary
 void clear()
          Removes all parameters from this collection.
 HttpParams copy()
          Creates a copy of these parameters.
protected  void copyParams(HttpParams target)
          Copies the locally defined parameters to the argument parameters.
 HttpParams getDefaults()
          Obtains default parameters, if set.
 java.lang.Object getParameter(java.lang.String name)
          Returns a parameter value with the given name.
 boolean isParameterSet(java.lang.String name)
          Returns true if the parameter is set at any level, false otherwise.
 boolean isParameterSetLocally(java.lang.String name)
          WARNING: This method is not part of the API.
 void setDefaults(HttpParams params)
          Provides default parameters.
 HttpParams setParameter(java.lang.String name, java.lang.Object value)
          Assigns the value to the parameter with the given name
 void setParameters(java.lang.String[] names, java.lang.Object value)
          Assigns the value to all the parameter with the given names
 
Methods inherited from class org.apache.http.params.AbstractHttpParams
getBooleanParameter, getDoubleParameter, getIntParameter, getLongParameter, isParameterFalse, isParameterTrue, setBooleanParameter, setDoubleParameter, setIntParameter, setLongParameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.http.params.HttpParams
getBooleanParameter, getDoubleParameter, getIntParameter, getLongParameter, isParameterFalse, isParameterTrue, setBooleanParameter, setDoubleParameter, setIntParameter, setLongParameter
 

Field Detail

defaults

protected HttpParams defaults
The optional set of default values to defer to.

Constructor Detail

BasicHttpParams

public BasicHttpParams(HttpParams defaults)
Creates a new collection of parameters with the given parent. The collection will defer to its parent for a default value if a particular parameter is not explicitly set in the collection itself.

Parameters:
defaults - the parent collection to defer to, if a parameter is not explictly set in the collection itself.

BasicHttpParams

public BasicHttpParams()
Method Detail

getDefaults

public HttpParams getDefaults()
Obtains default parameters, if set.

Specified by:
getDefaults in interface HttpLinkedParams
Returns:
the defaults, or null
See Also:
HttpLinkedParams.setDefaults(HttpParams)

setDefaults

public void setDefaults(HttpParams params)
Provides default parameters.

Specified by:
setDefaults in interface HttpLinkedParams
Parameters:
params - the new defaults, or null to unset
See Also:
HttpLinkedParams.getDefaults()

getParameter

public java.lang.Object getParameter(java.lang.String name)
Description copied from interface: HttpParams
Returns a parameter value with the given name. If the parameter is not explicitly defined in this collection, its value will be drawn from a higer level collection at which this parameter is defined. If the parameter is not explicitly set anywhere up the hierarchy, null value is returned.

Specified by:
getParameter in interface HttpParams
Parameters:
name - the parent name.
Returns:
an object that represents the value of the parameter.
See Also:
HttpParams.setParameter(String, Object)

setParameter

public HttpParams setParameter(java.lang.String name,
                               java.lang.Object value)
Description copied from interface: HttpParams
Assigns the value to the parameter with the given name

Specified by:
setParameter in interface HttpParams
Parameters:
name - parameter name
value - parameter value

setParameters

public void setParameters(java.lang.String[] names,
                          java.lang.Object value)
Assigns the value to all the parameter with the given names

Parameters:
names - array of parameter name
value - parameter value

isParameterSet

public boolean isParameterSet(java.lang.String name)
Description copied from interface: HttpParams
Returns true if the parameter is set at any level, false otherwise.

Specified by:
isParameterSet in interface HttpParams
Parameters:
name - parameter name
Returns:
true if the parameter is set at any level, false otherwise.

isParameterSetLocally

public boolean isParameterSetLocally(java.lang.String name)
Description copied from interface: HttpLinkedParams
WARNING: This method is not part of the API. It is intended for internal use by the HTTP Components framework. Use with caution.

Specified by:
isParameterSetLocally in interface HttpLinkedParams
Parameters:
name - the parameter name
Returns:
true if the parameter is set locally, false otherwise
See Also:
HttpLinkedParams.getDefaults(), HttpLinkedParams.setDefaults(HttpParams)

clear

public void clear()
Removes all parameters from this collection.


copy

public HttpParams copy()
Creates a copy of these parameters. The implementation here instantiates BasicHttpParams with the same default parameters as this object, then calls copyParams(HttpParams) to populate the copy.
Derived classes which have to change the class that is instantiated can override this method here. Derived classes which have to change how the copy is populated can override copyParams(HttpParams).

Specified by:
copy in interface HttpParams
Returns:
a new set of params holding a copy of the local parameters in this object. Defaults parameters available via getDefaults() are not copied.

copyParams

protected void copyParams(HttpParams target)
Copies the locally defined parameters to the argument parameters. Default parameters accessible via getDefaults() are not copied. This method is called from copy().

Parameters:
target - the parameters to which to copy


Copyright © 2005-2009 Apache Software Foundation. All Rights Reserved.