Class HttpClientParams
java.lang.Object
org.apache.commons.httpclient.params.DefaultHttpParams
org.apache.commons.httpclient.params.HttpMethodParams
org.apache.commons.httpclient.params.HttpClientParams
- All Implemented Interfaces:
Serializable, Cloneable, HttpParams
This class represents a collection of HTTP protocol parameters applicable to
instances of HttpClient.
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.- Since:
- 3.0
- Version:
- $Revision: 480424 $
- Author:
- Oleg Kalnichevski
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefines whether circular redirects (redirects to the same location) should be allowed.static final StringDefines the defaultHTTP connection managerclass.static final StringSets the timeout in milliseconds used when retrieving anHTTP connectionfrom theHTTP connection manager.static final StringDefines the maximum number of redirects to be followed.static final StringDefines whether authentication should be attempted preemptively.static final StringDefines whether relative redirects should be rejected.Fields inherited from class HttpMethodParams
BUFFER_WARN_TRIGGER_LIMIT, COOKIE_POLICY, CREDENTIAL_CHARSET, DATE_PATTERNS, HEAD_BODY_CHECK_TIMEOUT, HTTP_CONTENT_CHARSET, HTTP_ELEMENT_CHARSET, HTTP_URI_CHARSET, MULTIPART_BOUNDARY, PROTOCOL_VERSION, REJECT_HEAD_BODY, RETRY_HANDLER, SINGLE_COOKIE_HEADER, SO_TIMEOUT, STATUS_LINE_GARBAGE_LIMIT, STRICT_TRANSFER_ENCODING, UNAMBIGUOUS_STATUS_LINE, USE_EXPECT_CONTINUE, USER_AGENT, VIRTUAL_HOST, WARN_EXTRA_INPUT -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new collection of parameters with the collection returned byDefaultHttpParams.getDefaultParams()as a parent.HttpClientParams(HttpParams defaults) Creates a new collection of parameters with the given parent. -
Method Summary
Modifier and TypeMethodDescriptionReturns the defaultHTTP connection managerclass.longReturns the timeout in milliseconds used when retrieving anHTTP connectionfrom theHTTP connection manager.booleanReturns true if authentication should be attempted preemptively, false otherwise.voidMakes theHTTP methodsattempt to mimic the exact behaviour of commonly used HTTP agents, which many HTTP servers expect, even though such behaviour may violate the HTTP protocol specification (RFC 2616 and other relevant RFCs).voidMakes theHTTP methodsstrictly follow the HTTP protocol specification (RFC 2616 and other relevant RFCs).voidsetAuthenticationPreemptive(boolean value) Sets whether authentication should be attempted preemptively.voidsetConnectionManagerClass(Class clazz) SetsHTTP connection managerclass to be used der default.voidsetConnectionManagerTimeout(long timeout) Sets the timeout in milliseconds used when retrieving anHTTP connectionfrom theHTTP connection manager.Methods inherited from class HttpMethodParams
getContentCharset, getCookiePolicy, getCredentialCharset, getHttpElementCharset, getSoTimeout, getUriCharset, getVersion, getVirtualHost, setContentCharset, setCookiePolicy, setCredentialCharset, setHttpElementCharset, setSoTimeout, setUriCharset, setVersion, setVirtualHostMethods inherited from class DefaultHttpParams
clear, clone, getBooleanParameter, getDefaultParams, getDefaults, getDoubleParameter, getIntParameter, getLongParameter, getParameter, isParameterFalse, isParameterSet, isParameterSetLocally, isParameterTrue, setBooleanParameter, setDefaults, setDoubleParameter, setHttpParamsFactory, setIntParameter, setLongParameter, setParameter, setParameters
-
Field Details
-
CONNECTION_MANAGER_TIMEOUT
Sets the timeout in milliseconds used when retrieving anHTTP connectionfrom theHTTP connection manager.This parameter expects a value of type
Long.- See Also:
-
CONNECTION_MANAGER_CLASS
Defines the defaultHTTP connection managerclass.This parameter expects a value of type
Class.- See Also:
-
PREEMPTIVE_AUTHENTICATION
-
REJECT_RELATIVE_REDIRECT
-
MAX_REDIRECTS
-
ALLOW_CIRCULAR_REDIRECTS
Defines whether circular redirects (redirects to the same location) should be allowed. The HTTP spec is not sufficiently clear whether circular redirects are permitted, therefore optionally they can be enabledThis parameter expects a value of type
Boolean.- See Also:
-
-
Constructor Details
-
HttpClientParams
public HttpClientParams()Creates a new collection of parameters with the collection returned byDefaultHttpParams.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.- See Also:
-
HttpClientParams
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.- See Also:
-
-
Method Details
-
getConnectionManagerTimeout
public long getConnectionManagerTimeout()Returns the timeout in milliseconds used when retrieving anHTTP connectionfrom theHTTP connection manager.- Returns:
- timeout in milliseconds.
-
setConnectionManagerTimeout
public void setConnectionManagerTimeout(long timeout) Sets the timeout in milliseconds used when retrieving anHTTP connectionfrom theHTTP connection manager.- Parameters:
timeout- the timeout in milliseconds
-
getConnectionManagerClass
Returns the defaultHTTP connection managerclass.- Returns:
HTTP connection managerfactory class.
-
setConnectionManagerClass
SetsHTTP connection managerclass to be used der default.- Parameters:
clazz-HTTP connection managerfactory class.
-
isAuthenticationPreemptive
public boolean isAuthenticationPreemptive()Returns true if authentication should be attempted preemptively, false otherwise.- Returns:
- true if authentication should be attempted preemptively, false otherwise.
-
setAuthenticationPreemptive
public void setAuthenticationPreemptive(boolean value) Sets whether authentication should be attempted preemptively.- Parameters:
value- true if authentication should be attempted preemptively, false otherwise.
-
makeStrict
public void makeStrict()Description copied from class:HttpMethodParamsMakes theHTTP methodsstrictly follow the HTTP protocol specification (RFC 2616 and other relevant RFCs). It must be noted that popular HTTP agents have different degree of HTTP protocol compliance and some HTTP serves are programmed to expect the behaviour that does not strictly adhere to the HTTP specification.- Overrides:
makeStrictin classHttpMethodParams
-
makeLenient
public void makeLenient()Description copied from class:HttpMethodParamsMakes theHTTP methodsattempt to mimic the exact behaviour of commonly used HTTP agents, which many HTTP servers expect, even though such behaviour may violate the HTTP protocol specification (RFC 2616 and other relevant RFCs).- Overrides:
makeLenientin classHttpMethodParams
-