Package org.apache.commons.httpclient
Class HttpClient
java.lang.Object
org.apache.commons.httpclient.HttpClient
Deprecated.
Jakarta Commons HttpClient 3.x is deprecated in the Jenkins project.
It is not recommended to use it in any new code.
Instead, use HTTP client API plugins as a dependency in your code.
E.g.
Apache HttpComponents Client API 4.x Plugin or
Async HTTP Client Plugin.
An HTTP "user-agent", containing an HTTP state
and
one or more HTTP connections
, to which
HTTP methods
can be applied.
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Creates an instance of HttpClient using defaultparameter set
.HttpClient
(HttpConnectionManager httpConnectionManager) Deprecated.Creates an instance of HttpClient with a user specifiedHTTP connection manager
.HttpClient
(HttpClientParams params) Deprecated.Creates an instance of HttpClient using the givenparameter set
.HttpClient
(HttpClientParams params, HttpConnectionManager httpConnectionManager) Deprecated.Creates an instance of HttpClient with a user specifiedparameter set
andHTTP connection manager
. -
Method Summary
Modifier and TypeMethodDescriptionint
executeMethod
(HostConfiguration hostConfiguration, HttpMethod method) Deprecated.Executes the givenHTTP method
using customhost configuration
.int
executeMethod
(HostConfiguration hostconfig, HttpMethod method, HttpState state) Deprecated.Executes the givenHTTP method
using the given customhost configuration
with the given customHTTP state
.int
executeMethod
(HttpMethod method) Deprecated.Executes the givenHTTP method
.getHost()
Deprecated.use #getHostConfiguration()Deprecated.Returns thehost configuration
associated with the HttpClient.Deprecated.Returns theHTTP connection manager
associated with the HttpClient.Deprecated.ReturnsHTTP protocol parameters
associated with this HttpClient.int
getPort()
Deprecated.use #getHostConfiguration()getState()
Deprecated.ReturnsHTTP state
associated with the HttpClient.boolean
Deprecated.UseDefaultHttpParams.getParameter(String)
to exercise a more granular control over HTTP protocol strictness.void
setConnectionTimeout
(int newTimeoutInMilliseconds) void
setHostConfiguration
(HostConfiguration hostConfiguration) Deprecated.Assigns thehost configuration
to use with the HttpClient.void
setHttpConnectionFactoryTimeout
(long timeout) Deprecated.void
setHttpConnectionManager
(HttpConnectionManager httpConnectionManager) Deprecated.Assigns theHTTP connection manager
to use with the HttpClient.void
setParams
(HttpClientParams params) Deprecated.AssignsHTTP protocol parameters
for this HttpClient.void
Deprecated.AssignsHTTP state
for the HttpClient.void
setStrictMode
(boolean strictMode) Deprecated.UseDefaultHttpParams.setParameter(String, Object)
to exercise a more granular control over HTTP protocol strictness.void
setTimeout
(int newTimeoutInMilliseconds) Deprecated.
-
Constructor Details
-
HttpClient
public HttpClient()Deprecated.Creates an instance of HttpClient using defaultparameter set
.- See Also:
-
HttpClient
Deprecated.Creates an instance of HttpClient using the givenparameter set
.- Parameters:
params
- Theparameters
to use.- Since:
- 3.0
- See Also:
-
HttpClient
Deprecated.Creates an instance of HttpClient with a user specifiedparameter set
andHTTP connection manager
.- Parameters:
params
- Theparameters
to use.httpConnectionManager
- Theconnection manager
to use.- Since:
- 3.0
-
HttpClient
Deprecated.Creates an instance of HttpClient with a user specifiedHTTP connection manager
.- Parameters:
httpConnectionManager
- Theconnection manager
to use.- Since:
- 2.0
-
-
Method Details
-
getState
Deprecated.ReturnsHTTP state
associated with the HttpClient.- Returns:
- the shared client state
- See Also:
-
setState
Deprecated.AssignsHTTP state
for the HttpClient.- Parameters:
state
- the newHTTP state
for the client- See Also:
-
setStrictMode
public void setStrictMode(boolean strictMode) Deprecated.UseDefaultHttpParams.setParameter(String, Object)
to exercise a more granular control over HTTP protocol strictness.Defines how strictly the method follows the HTTP protocol specification (see RFC 2616 and other relevant RFCs). In the strict mode the method precisely implements the requirements of the specification, whereas in non-strict mode it attempts to mimic the exact behaviour of commonly used HTTP agents, which many HTTP servers expect.- Parameters:
strictMode
- true for strict mode, false otherwise- See Also:
-
isStrictMode
public boolean isStrictMode()Deprecated.UseDefaultHttpParams.getParameter(String)
to exercise a more granular control over HTTP protocol strictness.Returns the value of the strict mode flag.- Returns:
- true if strict mode is enabled, false otherwise
- See Also:
-
setTimeout
public void setTimeout(int newTimeoutInMilliseconds) Deprecated.Sets the 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:
newTimeoutInMilliseconds
- Timeout in milliseconds
-
setHttpConnectionFactoryTimeout
public void setHttpConnectionFactoryTimeout(long timeout) Deprecated.Sets the timeout in milliseconds used when retrieving anHTTP connection
from theHTTP connection manager
.- Parameters:
timeout
- the timeout in milliseconds- See Also:
-
setConnectionTimeout
public void setConnectionTimeout(int newTimeoutInMilliseconds) Sets the timeout until a connection is etablished. A value of zero means the timeout is not used. The default value is zero.- Parameters:
newTimeoutInMilliseconds
- Timeout in milliseconds.- See Also:
-
executeMethod
Deprecated.Executes the givenHTTP method
.- Parameters:
method
- theHTTP method
to execute.- Returns:
- the method's response code
- Throws:
IOException
- If an I/O (transport) error occurs. Some transport exceptions can be recovered from.HttpException
- If a protocol exception occurs. Usually protocol exceptions cannot be recovered from.
-
executeMethod
public int executeMethod(HostConfiguration hostConfiguration, HttpMethod method) throws IOException, HttpException Deprecated.Executes the givenHTTP method
using customhost configuration
.- Parameters:
hostConfiguration
- Thehost configuration
to use. Ifnull
, the host configuration returned bygetHostConfiguration()
will be used.method
- theHTTP method
to execute.- Returns:
- the method's response code
- Throws:
IOException
- If an I/O (transport) error occurs. Some transport exceptions can be recovered from.HttpException
- If a protocol exception occurs. Usually protocol exceptions cannot be recovered from.- Since:
- 2.0
-
executeMethod
public int executeMethod(HostConfiguration hostconfig, HttpMethod method, HttpState state) throws IOException, HttpException Deprecated.Executes the givenHTTP method
using the given customhost configuration
with the given customHTTP state
.- Parameters:
hostconfig
- Thehost configuration
to use. Ifnull
, the host configuration returned bygetHostConfiguration()
will be used.method
- theHTTP method
to execute.state
- theHTTP state
to use when executing the method. Ifnull
, the state returned bygetState()
will be used.- Returns:
- the method's response code
- Throws:
IOException
- If an I/O (transport) error occurs. Some transport exceptions can be recovered from.HttpException
- If a protocol exception occurs. Usually protocol exceptions cannot be recovered from.- Since:
- 2.0
-
getHost
Deprecated.use #getHostConfiguration()Returns the default host.- Returns:
- The default host.
-
getPort
public int getPort()Deprecated.use #getHostConfiguration()Returns the default port.- Returns:
- The default port.
-
getHostConfiguration
Deprecated.Returns thehost configuration
associated with the HttpClient.- Returns:
host configuration
- Since:
- 2.0
-
setHostConfiguration
Deprecated.Assigns thehost configuration
to use with the HttpClient.- Parameters:
hostConfiguration
- Thehost configuration
to set- Since:
- 2.0
-
getHttpConnectionManager
Deprecated.Returns theHTTP connection manager
associated with the HttpClient.- Returns:
HTTP connection manager
- Since:
- 2.0
-
setHttpConnectionManager
Deprecated.Assigns theHTTP connection manager
to use with the HttpClient.- Parameters:
httpConnectionManager
- TheHTTP connection manager
to set- Since:
- 2.0
-
getParams
Deprecated.ReturnsHTTP protocol parameters
associated with this HttpClient.- Since:
- 3.0
- See Also:
-
setParams
Deprecated.AssignsHTTP protocol parameters
for this HttpClient.- Since:
- 3.0
- See Also:
-