Package org.apache.commons.httpclient
Class HttpClient
- java.lang.Object
-
- org.apache.commons.httpclient.HttpClient
-
@Deprecated public class HttpClient extends java.lang.ObjectDeprecated.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 stateand one or moreHTTP connections, to whichHTTP methodscan 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 setandHTTP connection manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intexecuteMethod(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.java.lang.StringgetHost()Deprecated.use #getHostConfiguration()HostConfigurationgetHostConfiguration()Deprecated.Returns thehost configurationassociated with the HttpClient.HttpConnectionManagergetHttpConnectionManager()Deprecated.Returns theHTTP connection managerassociated with the HttpClient.HttpClientParamsgetParams()Deprecated.ReturnsHTTP protocol parametersassociated with this HttpClient.intgetPort()Deprecated.use #getHostConfiguration()HttpStategetState()Deprecated.ReturnsHTTP stateassociated with the HttpClient.booleanisStrictMode()Deprecated.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.voidsetState(HttpState state)Deprecated.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 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- Theparametersto use.- Since:
- 3.0
- See Also:
HttpClientParams
-
HttpClient
public HttpClient(HttpClientParams params, HttpConnectionManager httpConnectionManager)
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
public HttpClient(HttpConnectionManager httpConnectionManager)
Deprecated.Creates an instance of HttpClient with a user specifiedHTTP connection manager.- Parameters:
httpConnectionManager- Theconnection managerto use.- Since:
- 2.0
-
-
Method Detail
-
getState
public HttpState getState()
Deprecated.ReturnsHTTP stateassociated with the HttpClient.- Returns:
- the shared client state
- See Also:
setState(HttpState)
-
setState
public void setState(HttpState state)
Deprecated.AssignsHTTP statefor the HttpClient.- Parameters:
state- the newHTTP statefor 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 connectionfrom 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 methodto 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 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:
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 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:
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 configurationassociated with the HttpClient.- Returns:
host configuration- Since:
- 2.0
-
setHostConfiguration
public void setHostConfiguration(HostConfiguration hostConfiguration)
Deprecated.Assigns thehost configurationto use with the HttpClient.- Parameters:
hostConfiguration- Thehost configurationto set- Since:
- 2.0
-
getHttpConnectionManager
public HttpConnectionManager getHttpConnectionManager()
Deprecated.Returns theHTTP connection managerassociated with the HttpClient.- Returns:
HTTP connection manager- Since:
- 2.0
-
setHttpConnectionManager
public void setHttpConnectionManager(HttpConnectionManager httpConnectionManager)
Deprecated.Assigns theHTTP connection managerto use with the HttpClient.- Parameters:
httpConnectionManager- TheHTTP connection managerto set- Since:
- 2.0
-
getParams
public HttpClientParams getParams()
Deprecated.ReturnsHTTP protocol parametersassociated with this HttpClient.- Since:
- 3.0
- See Also:
HttpClientParams
-
setParams
public void setParams(HttpClientParams params)
Deprecated.AssignsHTTP protocol parametersfor this HttpClient.- Since:
- 3.0
- See Also:
HttpClientParams
-
-