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 setandHTTP connection manager. -
Method Summary
Modifier and TypeMethodDescriptionintexecuteMethod(HostConfiguration hostConfiguration, HttpMethod method) Deprecated.Executes the givenHTTP methodusing customhost configuration.intexecuteMethod(HostConfiguration hostconfig, HttpMethod method, HttpState state) Deprecated.Executes the givenHTTP methodusing the given customhost configurationwith the given customHTTP state.intexecuteMethod(HttpMethod method) Deprecated.Executes the givenHTTP method.getHost()Deprecated.use #getHostConfiguration()Deprecated.Returns thehost configurationassociated with the HttpClient.Deprecated.Returns theHTTP connection managerassociated with the HttpClient.Deprecated.ReturnsHTTP protocol parametersassociated with this HttpClient.intgetPort()Deprecated.use #getHostConfiguration()getState()Deprecated.ReturnsHTTP stateassociated with the HttpClient.booleanDeprecated.UseDefaultHttpParams.getParameter(String)to exercise a more granular control over HTTP protocol strictness.voidsetConnectionTimeout(int newTimeoutInMilliseconds) voidsetHostConfiguration(HostConfiguration hostConfiguration) Deprecated.Assigns thehost configurationto use with the HttpClient.voidsetHttpConnectionFactoryTimeout(long timeout) Deprecated.voidsetHttpConnectionManager(HttpConnectionManager httpConnectionManager) Deprecated.Assigns theHTTP connection managerto use with the HttpClient.voidsetParams(HttpClientParams params) Deprecated.AssignsHTTP protocol parametersfor this HttpClient.voidDeprecated.AssignsHTTP statefor the HttpClient.voidsetStrictMode(boolean strictMode) Deprecated.UseDefaultHttpParams.setParameter(String, Object)to exercise a more granular control over HTTP protocol strictness.voidsetTimeout(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- Theparametersto use.- Since:
- 3.0
- See Also:
-
HttpClient
Deprecated.Creates an instance of HttpClient with a user specifiedparameter setandHTTP connection manager.- Parameters:
params- Theparametersto use.httpConnectionManager- Theconnection managerto use.- Since:
- 3.0
-
HttpClient
Deprecated.Creates an instance of HttpClient with a user specifiedHTTP connection manager.- Parameters:
httpConnectionManager- Theconnection managerto use.- Since:
- 2.0
-
-
Method Details
-
getState
Deprecated.ReturnsHTTP stateassociated with the HttpClient.- Returns:
- the shared client state
- See Also:
-
setState
Deprecated.AssignsHTTP statefor the HttpClient.- Parameters:
state- the newHTTP statefor 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 connectionfrom 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 methodto 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 methodusing customhost configuration.- Parameters:
hostConfiguration- Thehost configurationto use. Ifnull, the host configuration returned bygetHostConfiguration()will be used.method- theHTTP methodto 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 methodusing the given customhost configurationwith the given customHTTP state.- Parameters:
hostconfig- Thehost configurationto use. Ifnull, the host configuration returned bygetHostConfiguration()will be used.method- theHTTP methodto execute.state- theHTTP stateto 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 configurationassociated with the HttpClient.- Returns:
host configuration- Since:
- 2.0
-
setHostConfiguration
Deprecated.Assigns thehost configurationto use with the HttpClient.- Parameters:
hostConfiguration- Thehost configurationto set- Since:
- 2.0
-
getHttpConnectionManager
Deprecated.Returns theHTTP connection managerassociated with the HttpClient.- Returns:
HTTP connection manager- Since:
- 2.0
-
setHttpConnectionManager
Deprecated.Assigns theHTTP connection managerto use with the HttpClient.- Parameters:
httpConnectionManager- TheHTTP connection managerto set- Since:
- 2.0
-
getParams
Deprecated.ReturnsHTTP protocol parametersassociated with this HttpClient.- Since:
- 3.0
- See Also:
-
setParams
Deprecated.AssignsHTTP protocol parametersfor this HttpClient.- Since:
- 3.0
- See Also:
-