org.apache.commons.httpclient.params

Class DefaultHttpParams

Implemented Interfaces:
Cloneable, HttpParams, Serializable
Known Direct Subclasses:
HostParams, HttpConnectionParams, HttpMethodParams

public class DefaultHttpParams
extends java.lang.Object
implements HttpParams, 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.
Version:
$Revision: 155418 $
Author:
Oleg Kalnichevski
Since:
3.0

Constructor Summary

DefaultHttpParams()
Creates a new collection of parameters with the collection returned by getDefaultParams() as a parent.
DefaultHttpParams(HttpParams defaults)
Creates a new collection of parameters with the given parent.

Method Summary

void
clear()
Removes all parameters from this collection.
Object
clone()
Clones this collection of parameters.
boolean
getBooleanParameter(String name, boolean defaultValue)
static HttpParams
getDefaultParams()
Gets the default HttpParams to be used.
HttpParams
getDefaults()
double
getDoubleParameter(String name, double defaultValue)
int
getIntParameter(String name, int defaultValue)
long
getLongParameter(String name, long defaultValue)
Object
getParameter(String name)
boolean
isParameterFalse(String name)
boolean
isParameterSet(String name)
boolean
isParameterSetLocally(String name)
boolean
isParameterTrue(String name)
void
setBooleanParameter(String name, boolean value)
void
setDefaults(HttpParams params)
void
setDoubleParameter(String name, double value)
static void
setHttpParamsFactory(HttpParamsFactory httpParamsFactory)
Sets the factory that will provide the default HttpParams.
void
setIntParameter(String name, int value)
void
setLongParameter(String name, long value)
void
setParameter(String name, Object value)
void
setParameters(String[] names, Object value)
Assigns the value to all the parameter with the given names

Constructor Details

DefaultHttpParams

public DefaultHttpParams()
Creates a new collection of parameters with the collection returned by getDefaultParams() as a parent. The collection will defer to its parent for a default value if a particular parameter is not explicitly set in the collection itself.

DefaultHttpParams

public DefaultHttpParams(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.

Method Details

clear

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

clone

public Object clone()
            throws CloneNotSupportedException
Clones this collection of parameters. Please note that paramter values themselves are not cloned.
See Also:
java.io.Serializable, java.lang.Object.clone()

getBooleanParameter

public boolean getBooleanParameter(String name,
                                   boolean defaultValue)
Specified by:
getBooleanParameter in interface HttpParams

getDefaultParams

public static HttpParams getDefaultParams()
Gets the default HttpParams to be used.
Returns:
the value returned from HttpParamsFactory#getDefaultParams()

getDefaults

public HttpParams getDefaults()
Specified by:
getDefaults in interface HttpParams

getDoubleParameter

public double getDoubleParameter(String name,
                                 double defaultValue)
Specified by:
getDoubleParameter in interface HttpParams

getIntParameter

public int getIntParameter(String name,
                           int defaultValue)
Specified by:
getIntParameter in interface HttpParams

getLongParameter

public long getLongParameter(String name,
                             long defaultValue)
Specified by:
getLongParameter in interface HttpParams

getParameter

public Object getParameter(String name)
Specified by:
getParameter in interface HttpParams

isParameterFalse

public boolean isParameterFalse(String name)
Specified by:
isParameterFalse in interface HttpParams

isParameterSet

public boolean isParameterSet(String name)
Specified by:
isParameterSet in interface HttpParams

isParameterSetLocally

public boolean isParameterSetLocally(String name)
Specified by:
isParameterSetLocally in interface HttpParams

isParameterTrue

public boolean isParameterTrue(String name)
Specified by:
isParameterTrue in interface HttpParams

setBooleanParameter

public void setBooleanParameter(String name,
                                boolean value)
Specified by:
setBooleanParameter in interface HttpParams

setDefaults

public void setDefaults(HttpParams params)
Specified by:
setDefaults in interface HttpParams

setDoubleParameter

public void setDoubleParameter(String name,
                               double value)
Specified by:
setDoubleParameter in interface HttpParams

setHttpParamsFactory

public static void setHttpParamsFactory(HttpParamsFactory httpParamsFactory)
Sets the factory that will provide the default HttpParams.
Parameters:
httpParamsFactory - an instance of HttpParamsFactory

setIntParameter

public void setIntParameter(String name,
                            int value)
Specified by:
setIntParameter in interface HttpParams

setLongParameter

public void setLongParameter(String name,
                             long value)
Specified by:
setLongParameter in interface HttpParams

setParameter

public void setParameter(String name,
                         Object value)
Specified by:
setParameter in interface HttpParams

setParameters

public void setParameters(String[] names,
                          Object value)
Assigns the value to all the parameter with the given names
Parameters:
names - array of parameter name
value - parameter value

Copyright (c) 1999-2005 - Apache Software Foundation