Package org.apache.commons.httpclient
Class HttpClient
- java.lang.Object
-
- org.apache.commons.httpclient.HttpClient
-
@Deprecated public class HttpClient extends java.lang.Object
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 moreHTTP connections
, to whichHTTP methods
can be applied.
-
-
Constructor Summary
Constructors Constructor Description HttpClient()
Deprecated.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
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
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
.java.lang.String
getHost()
Deprecated.use #getHostConfiguration()HostConfiguration
getHostConfiguration()
Deprecated.Returns thehost configuration
associated with the HttpClient.HttpConnectionManager
getHttpConnectionManager()
Deprecated.Returns theHTTP connection manager
associated with the HttpClient.HttpClientParams
getParams()
Deprecated.ReturnsHTTP protocol parameters
associated with this HttpClient.int
getPort()
Deprecated.use #getHostConfiguration()HttpState
getState()
Deprecated.ReturnsHTTP state
associated with the HttpClient.boolean
isStrictMode()
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
setState(HttpState state)
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 Detail
-
HttpClient
public HttpClient()
Deprecated.Creates an instance of HttpClient using defaultparameter set
.- See Also:
HttpClientParams
-
HttpClient
public HttpClient(HttpClientParams params)
Deprecated.Creates an instance of HttpClient using the givenparameter set
.- Parameters:
params
- Theparameters
to use.- Since:
- 3.0
- See Also:
HttpClientParams
-
HttpClient
public HttpClient(HttpClientParams params, HttpConnectionManager httpConnectionManager)
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
public HttpClient(HttpConnectionManager httpConnectionManager)
Deprecated.Creates an instance of HttpClient with a user specifiedHTTP connection manager
.- Parameters:
httpConnectionManager
- Theconnection manager
to use.- Since:
- 2.0
-
-
Method Detail
-
getState
public HttpState getState()
Deprecated.ReturnsHTTP state
associated with the HttpClient.- Returns:
- the shared client state
- See Also:
setState(HttpState)
-
setState
public void setState(HttpState state)
Deprecated.AssignsHTTP state
for the HttpClient.- Parameters:
state
- the newHTTP state
for the client- See Also:
getState()
-
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()
-
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:
setStrictMode(boolean)
-
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:
HttpConnectionManager.getConnection(HostConfiguration, long)
-
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:
HttpConnection.setConnectionTimeout(int)
-
executeMethod
public int executeMethod(HttpMethod method) throws java.io.IOException, HttpException
Deprecated.Executes the givenHTTP method
.- Parameters:
method
- theHTTP method
to execute.- Returns:
- the method's response code
- Throws:
java.io.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 java.io.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:
java.io.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 java.io.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:
java.io.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
public java.lang.String 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
public HostConfiguration getHostConfiguration()
Deprecated.Returns thehost configuration
associated with the HttpClient.- Returns:
host configuration
- Since:
- 2.0
-
setHostConfiguration
public void setHostConfiguration(HostConfiguration hostConfiguration)
Deprecated.Assigns thehost configuration
to use with the HttpClient.- Parameters:
hostConfiguration
- Thehost configuration
to set- Since:
- 2.0
-
getHttpConnectionManager
public HttpConnectionManager getHttpConnectionManager()
Deprecated.Returns theHTTP connection manager
associated with the HttpClient.- Returns:
HTTP connection manager
- Since:
- 2.0
-
setHttpConnectionManager
public void setHttpConnectionManager(HttpConnectionManager httpConnectionManager)
Deprecated.Assigns theHTTP connection manager
to use with the HttpClient.- Parameters:
httpConnectionManager
- TheHTTP connection manager
to set- Since:
- 2.0
-
getParams
public HttpClientParams getParams()
Deprecated.ReturnsHTTP protocol parameters
associated with this HttpClient.- Since:
- 3.0
- See Also:
HttpClientParams
-
setParams
public void setParams(HttpClientParams params)
Deprecated.AssignsHTTP protocol parameters
for this HttpClient.- Since:
- 3.0
- See Also:
HttpClientParams
-
-