| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Objectorg.apache.commons.httpclient.HttpClientpublic class HttpClientextends java.lang.ObjectHTTP state and
one or more HTTP connections, to which
HTTP methods can be applied.
Constructor Summary | |
| |
| |
| |
| |
Method Summary | |
int |
|
int |
|
int |
|
String |
|
HostConfiguration |
|
HttpConnectionManager |
|
HttpClientParams |
|
int |
|
HttpState |
|
boolean |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
public HttpClient()
Creates an instance of HttpClient using defaultparameter set.
- See Also:
HttpClientParams
public HttpClient(HttpConnectionManager httpConnectionManager)
Creates an instance of HttpClient with a user specifiedHTTP connection manager.
- Parameters:
httpConnectionManager- Theconnection managerto use.
- Since:
- 2.0
public HttpClient(HttpClientParams params)
Creates an instance of HttpClient using the givenparameter set.
- Parameters:
params- Theparametersto use.
- Since:
- 3.0
- See Also:
HttpClientParams
public HttpClient(HttpClientParams params, HttpConnectionManager httpConnectionManager)
Creates an instance of HttpClient with a user specifiedparameter setandHTTP connection manager.
- Parameters:
params- Theparametersto use.httpConnectionManager- Theconnection managerto use.
- Since:
- 3.0
public int executeMethod(HostConfiguration hostConfiguration, HttpMethod method) throws IOException, HttpException
Executes the givenHTTP methodusing customhost configuration.
- Parameters:
hostConfiguration- Thehost configurationto use.method- theHTTP methodto execute.
- Returns:
- the method's response code
- Throws:
HttpException- If a protocol exception occurs. Usually protocol exceptions cannot be recovered from.
- Since:
- 2.0
public int executeMethod(HostConfiguration hostconfig, HttpMethod method, HttpState state) throws IOException, HttpException
Executes the givenHTTP methodusing the given customhost configurationwith the given customHTTP state.
- Parameters:
hostconfig- Thehost configurationto use.method- theHTTP methodto execute.state- theHTTP stateto use when executing the method. Ifnull, the state returned bygetState()will be used instead.
- Returns:
- the method's response code
- Throws:
HttpException- If a protocol exception occurs. Usually protocol exceptions cannot be recovered from.
- Since:
- 2.0
public int executeMethod(HttpMethod method) throws IOException, HttpException
Executes the givenHTTP method.
- Parameters:
method- theHTTP methodto execute.
- Returns:
- the method's response code
- Throws:
HttpException- If a protocol exception occurs. Usually protocol exceptions cannot be recovered from.
public String getHost()
Deprecated. use #getHostConfiguration()
Returns the default host.
- Returns:
- The default host.
public HostConfiguration getHostConfiguration()
Returns thehost configurationassociated with the HttpClient.
- Returns:
host configuration
- Since:
- 2.0
public HttpConnectionManager getHttpConnectionManager()
Returns theHTTP connection managerassociated with the HttpClient.
- Returns:
HTTP connection manager
- Since:
- 2.0
public HttpClientParams getParams()
ReturnsHTTP protocol parametersassociated with this HttpClient.
- Since:
- 3.0
- See Also:
HttpClientParams
public int getPort()
Deprecated. use #getHostConfiguration()
Returns the default port.
- Returns:
- The default port.
public HttpState getState()
ReturnsHTTP stateassociated with the HttpClient.
- Returns:
- the shared client state
- See Also:
setState(HttpState)
public boolean isStrictMode()
Deprecated. Use
HttpClientParams.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)
public void setConnectionTimeout(int newTimeoutInMilliseconds)
Deprecated. Use
HttpConnectionManagerParams.setConnectionTimeout(int),HttpConnectionManager.getParams().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.
public void setHostConfiguration(HostConfiguration hostConfiguration)
Assigns thehost configurationto use with the HttpClient.
- Parameters:
hostConfiguration- Thehost configurationto set
- Since:
- 2.0
public void setHttpConnectionFactoryTimeout(long timeout)
Deprecated. Use
HttpClientParams.setConnectionManagerTimeout(long),getParams()Sets the timeout in milliseconds used when retrieving anHTTP connectionfrom theHTTP connection manager.
- Parameters:
timeout- the timeout in milliseconds
public void setHttpConnectionManager(HttpConnectionManager httpConnectionManager)
Assigns theHTTP connection managerto use with the HttpClient.
- Parameters:
httpConnectionManager- TheHTTP connection managerto set
- Since:
- 2.0
public void setParams(HttpClientParams params)
AssignsHTTP protocol parametersfor this HttpClient.
- Since:
- 3.0
- See Also:
HttpClientParams
public void setState(HttpState state)
AssignsHTTP statefor the HttpClient.
- Parameters:
state- the newHTTP statefor the client
- See Also:
getState()
public void setStrictMode(boolean strictMode)
Deprecated. Use
HttpClientParams.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 void setTimeout(int newTimeoutInMilliseconds)
Deprecated. Use
HttpConnectionManagerParams.setSoTimeout(int),HttpConnectionManager.getParams().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