Class HttpMethodParams
- All Implemented Interfaces:
Serializable, Cloneable, HttpParams
- Direct Known Subclasses:
HttpClientParams
HTTP methods. 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: 483949 $
- Author:
- Oleg Kalnichevski, Christian Kohlschuetter
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSets the maximum buffered response size (in bytes) that triggers no warning.static final StringDefinescookie policyto be used for cookie management.static final StringDefines the charset to be used when encodingCredentials.static final StringThe key used to look up the date patterns used for parsing.static final StringSets period of time in milliseconds to wait for a content body sent in response toHEAD methodfrom a non-compliant server.static final StringDefines the charset to be used for encoding content body.static final StringDefines the charset to be used for encoding HTTP protocol elements.static final StringDefines the charset to be used for parsing URIs.static final StringSets the value to use as the multipart boundary.static final StringDefines theHTTP protocol versionused byHTTP methodsper default.static final StringDefines whether the content body sent in response toHeadMethodshould be rejected.static final StringSets the method retry handler parameter.static final StringDefines whethercookiesshould be put on a singleresponse header.static final StringSets the socket timeout (SO_TIMEOUT) in milliseconds to be used when executing the method.static final StringDefines the maximum number of ignorable lines before we expect a HTTP response's status code.static final StringDefines whether responses with an invalid Transfer-Encoding header should be rejected.static final StringDefines whetherHTTP methodsshould reject ambiguousHTTP status line.static final StringActivates 'Expect: 100-Continue' handshake for theentity enclosing methods.static final StringDefines the content of the User-Agent header used byHTTP methods.static final StringDefines the virtual host name.static final StringDefines HttpClient's behavior when a response provides more bytes than expected (specified with Content-Length, for example). -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new collection of parameters with the collection returned byDefaultHttpParams.getDefaultParams()as a parent.HttpMethodParams(HttpParams defaults) Creates a new collection of parameters with the given parent. -
Method Summary
Modifier and TypeMethodDescriptionReturns the default charset to be used for writing content body, when no charset explicitly specified.Returnscookie policyto be used by theHTTP methodsthis collection of parameters applies to.Returns the charset to be used forCredentials.Returns the charset to be used for writing HTTP headers.intReturns the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data.Returns the charset to be used for parsing URIs.ReturnsHTTP protocol versionto be used by theHTTP methodsthat this collection of parameters applies to.Returns the virtual host name.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).voidsetContentCharset(String charset) Sets the default charset to be used for writing content body, when no charset explicitly specified.voidsetCookiePolicy(String policy) Assigns thecookie policyto be used by theHTTP methodsthis collection of parameters applies to.voidsetCredentialCharset(String charset) Sets the charset to be used for writing HTTP headers.voidsetHttpElementCharset(String charset) Sets the charset to be used for writing HTTP headers.voidsetSoTimeout(int timeout) Sets the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data.voidsetUriCharset(String charset) Sets the charset to be used for parsing URIs.voidsetVersion(HttpVersion version) Assigns theHTTP protocol versionto be used by theHTTP methodsthat this collection of parameters applies to.voidsetVirtualHost(String hostname) Sets the virtual host name.Methods 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
-
USER_AGENT
Defines the content of the User-Agent header used byHTTP methods.This parameter expects a value of type
String.- See Also:
-
PROTOCOL_VERSION
Defines theHTTP protocol versionused byHTTP methodsper default.This parameter expects a value of type
HttpVersion.- See Also:
-
UNAMBIGUOUS_STATUS_LINE
Defines whetherHTTP methodsshould reject ambiguousHTTP status line.This parameter expects a value of type
Boolean.- See Also:
-
SINGLE_COOKIE_HEADER
Defines whethercookiesshould be put on a singleresponse header.This parameter expects a value of type
Boolean.- See Also:
-
STRICT_TRANSFER_ENCODING
-
REJECT_HEAD_BODY
Defines whether the content body sent in response toHeadMethodshould be rejected.This parameter expects a value of type
Boolean.- See Also:
-
HEAD_BODY_CHECK_TIMEOUT
Sets period of time in milliseconds to wait for a content body sent in response toHEAD methodfrom a non-compliant server. If the parameter is not set or set to -1 non-compliant response body check is disabled.This parameter expects a value of type
Integer.- See Also:
-
USE_EXPECT_CONTINUE
Activates 'Expect: 100-Continue' handshake for the
entity enclosing methods. The purpose of the 'Expect: 100-Continue' handshake to allow a client that is sending a request message with a request body to determine if the origin server is willing to accept the request (based on the request headers) before the client sends the request body.The use of the 'Expect: 100-continue' handshake can result in noticable peformance improvement for entity enclosing requests (such as POST and PUT) that require the target server's authentication.
'Expect: 100-continue' handshake should be used with caution, as it may cause problems with HTTP servers and proxies that do not support HTTP/1.1 protocol.
This parameter expects a value of typeBoolean.- See Also:
-
CREDENTIAL_CHARSET
Defines the charset to be used when encodingCredentials. If not defined then theHTTP_ELEMENT_CHARSETshould be used.This parameter expects a value of type
String.- See Also:
-
HTTP_ELEMENT_CHARSET
-
HTTP_URI_CHARSET
-
HTTP_CONTENT_CHARSET
-
COOKIE_POLICY
Definescookie policyto be used for cookie management.This parameter expects a value of type
String.- See Also:
-
WARN_EXTRA_INPUT
Defines HttpClient's behavior when a response provides more bytes than expected (specified with Content-Length, for example).Such surplus data makes the HTTP connection unreliable for keep-alive requests, as malicious response data (faked headers etc.) can lead to undesired results on the next request using that connection.
If this parameter is set to
true, any detection of extra input data will generate a warning in the log.This parameter expects a value of type
Boolean.- See Also:
-
STATUS_LINE_GARBAGE_LIMIT
Defines the maximum number of ignorable lines before we expect a HTTP response's status code.With HTTP/1.1 persistent connections, the problem arises that broken scripts could return a wrong Content-Length (there are more bytes sent than specified).
Unfortunately, in some cases, this is not possible after the bad response, but only before the next one.
So, HttpClient must be able to skip those surplus lines this way.Set this to 0 to disallow any garbage/empty lines before the status line.
This parameter expects a value of type
To specify no limit, useInteger.MAX_VALUE(default in lenient mode).Integer.- See Also:
-
SO_TIMEOUT
-
DATE_PATTERNS
The key used to look up the date patterns used for parsing. The String patterns are stored in aCollectionand must be compatible withSimpleDateFormat.This parameter expects a value of type
Collection.- See Also:
-
RETRY_HANDLER
Sets the method retry handler parameter.This parameter expects a value of type
HttpMethodRetryHandler.- See Also:
-
BUFFER_WARN_TRIGGER_LIMIT
-
VIRTUAL_HOST
-
MULTIPART_BOUNDARY
-
-
Constructor Details
-
HttpMethodParams
public HttpMethodParams()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:
-
HttpMethodParams
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
-
getHttpElementCharset
Returns the charset to be used for writing HTTP headers.- Returns:
- The charset
-
setHttpElementCharset
Sets the charset to be used for writing HTTP headers.- Parameters:
charset- The charset
-
getContentCharset
Returns the default charset to be used for writing content body, when no charset explicitly specified.- Returns:
- The charset
-
setUriCharset
Sets the charset to be used for parsing URIs.- Parameters:
charset- The charset
-
getUriCharset
-
setContentCharset
Sets the default charset to be used for writing content body, when no charset explicitly specified.- Parameters:
charset- The charset
-
getCredentialCharset
Returns the charset to be used forCredentials. If not configured theHTTP element charsetis used.- Returns:
- The charset
-
setCredentialCharset
Sets the charset to be used for writing HTTP headers.- Parameters:
charset- The charset
-
getVersion
ReturnsHTTP protocol versionto be used by theHTTP methodsthat this collection of parameters applies to.- Returns:
HTTP protocol version
-
setVersion
Assigns theHTTP protocol versionto be used by theHTTP methodsthat this collection of parameters applies to.- Parameters:
version- theHTTP protocol version
-
getCookiePolicy
Returnscookie policyto be used by theHTTP methodsthis collection of parameters applies to.- Returns:
cookie policy
-
setCookiePolicy
Assigns thecookie policyto be used by theHTTP methodsthis collection of parameters applies to.- Parameters:
policy- thecookie policy
-
getSoTimeout
public int getSoTimeout()Returns the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data. A timeout value of zero is interpreted as an infinite timeout.- Returns:
- timeout in milliseconds
-
setSoTimeout
public void setSoTimeout(int timeout) Sets the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data. A timeout value of zero is interpreted as an infinite timeout.- Parameters:
timeout- Timeout in milliseconds
-
setVirtualHost
Sets the virtual host name.- Parameters:
hostname- The host name
-
getVirtualHost
-
makeStrict
public void makeStrict()Makes 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. -
makeLenient
public void makeLenient()Makes 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).
-