|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--org.apache.commons.httpclient.HttpClient
An HTTP "user-agent", containing an HTTP state and
one or more HTTP connections, to which
HTTP methods can be applied.
| Constructor Summary | |
HttpClient()
Creates an instance of HttpClient using a simple HTTP connection manager. |
|
HttpClient(HttpConnectionManager httpConnectionManager)
Creates an instance of HttpClient with a user specified connection manager. |
|
| Method Summary | |
void |
endSession()
Deprecated. this method has no effect. HttpMethod.releaseConnection()
should be used to release resources after a HttpMethod has been executed. |
int |
executeMethod(HostConfiguration hostConfiguration,
HttpMethod method)
Executes the given HTTP method using custom
host configuration. |
int |
executeMethod(HostConfiguration hostConfiguration,
HttpMethod method,
HttpState state)
Executes the given HTTP method using the given custom
host configuration with the given custom
HTTP state. |
int |
executeMethod(HttpMethod method)
Executes the given HTTP method. |
java.lang.String |
getHost()
Returns the host that the client is accessing. |
HostConfiguration |
getHostConfiguration()
Returns the host configuration associated with the
HttpClient. |
HttpConnectionManager |
getHttpConnectionManager()
Returns the HTTP connection manager associated
with the HttpClient. |
int |
getPort()
Returns the port that the client is accessing. |
HttpState |
getState()
Returns HTTP state associated with the HttpClient. |
boolean |
isStrictMode()
Returns the value of the strict mode flag. |
void |
setConnectionTimeout(int newTimeoutInMilliseconds)
Sets the timeout until a connection is etablished. |
void |
setHostConfiguration(HostConfiguration hostConfiguration)
Assigns the host configuration to use with the
HttpClient. |
void |
setHttpConnectionFactoryTimeout(long timeout)
Sets the timeout in milliseconds used when retrieving an HTTP connection from the
HTTP connection manager. |
void |
setHttpConnectionManager(HttpConnectionManager httpConnectionManager)
Assigns the HTTP connection manager to use with
the HttpClient. |
void |
setState(HttpState state)
Assigns HTTP state for the HttpClient. |
void |
setStrictMode(boolean strictMode)
Defines how strictly the method follows the HTTP protocol specification (see RFC 2616 and other relevant RFCs). |
void |
setTimeout(int newTimeoutInMilliseconds)
Sets the socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data. |
void |
startSession(java.lang.String host,
int port)
Deprecated. use HostConfiguration |
void |
startSession(java.lang.String host,
int port,
boolean https)
Deprecated. use HostConfiguration |
void |
startSession(java.lang.String host,
int port,
Credentials creds)
Deprecated. use HostConfiguration and HttpState |
void |
startSession(java.lang.String host,
int port,
Credentials creds,
boolean https)
Deprecated. use HostConfiguration and HttpState |
void |
startSession(java.lang.String host,
int port,
java.lang.String proxyhost,
int proxyport)
Deprecated. use HostConfiguration |
void |
startSession(java.lang.String host,
int port,
java.lang.String proxyhost,
int proxyport,
boolean secure)
Deprecated. use HostConfiguration |
void |
startSession(URI uri)
Deprecated. use HostConfiguration |
void |
startSession(java.net.URL url)
Deprecated. use HostConfiguration |
void |
startSession(java.net.URL url,
Credentials creds)
Deprecated. use HostConfiguration and HttpState |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public HttpClient()
simple HTTP connection manager.SimpleHttpConnectionManagerpublic HttpClient(HttpConnectionManager httpConnectionManager)
httpConnectionManager - The connection manager
to use.| Method Detail |
public HttpState getState()
HTTP state associated with the HttpClient.setState(HttpState)public void setState(HttpState state)
HTTP state for the HttpClient.state - the new HTTP state for the clientgetState()public void setStrictMode(boolean strictMode)
strictMode - true for strict mode, false otherwiseisStrictMode()public boolean isStrictMode()
setStrictMode(boolean)public void setTimeout(int newTimeoutInMilliseconds)
newTimeoutInMilliseconds - Timeout in millisecondspublic void setHttpConnectionFactoryTimeout(long timeout)
HTTP connection from the
HTTP connection manager.timeout - the timeout in millisecondsHttpConnectionManager.getConnection(HostConfiguration, long)public void setConnectionTimeout(int newTimeoutInMilliseconds)
newTimeoutInMilliseconds - Timeout in milliseconds.HttpConnection.setConnectionTimeout(int)
public void startSession(java.lang.String host,
int port)
HostConfiguration
host - the host to connect toport - the port to connect togetHostConfiguration()
public void startSession(java.lang.String host,
int port,
boolean https)
HostConfiguration
host - the host to connect toport - the port to connect tohttps - when true, create an HTTPS sessiongetHostConfiguration()
public void startSession(java.lang.String host,
int port,
Credentials creds)
HostConfiguration and HttpState
host - the host to connect toport - the port to connect tocreds - the default credentials to usegetHostConfiguration(),
getState(),
startSession(String, int, Credentials, boolean)
public void startSession(java.lang.String host,
int port,
Credentials creds,
boolean https)
HostConfiguration and HttpState
host - the host to connect toport - the port to connect tocreds - the default credentials to usehttps - when true, create an HTTPS sessiongetHostConfiguration(),
getState()
public void startSession(URI uri)
throws URIException,
java.lang.IllegalStateException
HostConfiguration
Note that the path component is not utilized.
uri - an HttpURL or HttpsURL instance; the
URI from which the scheme, userinfo, host and port of the
session are determinedgetHostConfiguration()
public void startSession(java.net.URL url)
throws java.lang.IllegalArgumentException
HostConfiguration
Note that everything but the protocol, host and port of the given url is ignored.
url - the URL from which the protocol, host, and port of
the session are determinedgetHostConfiguration()
public void startSession(java.net.URL url,
Credentials creds)
throws java.lang.IllegalArgumentException
HostConfiguration and HttpState
Note that everything but the protocol, host and port of the given url is ignored.
url - the URL from which the protocol, host, and port of
the session are determinedcreds - the default credentials to usegetHostConfiguration(),
getState()
public void startSession(java.lang.String host,
int port,
java.lang.String proxyhost,
int proxyport)
HostConfiguration
host - the host to connect toport - the port to connect toproxyhost - the proxy host to connect viaproxyport - the proxy port to connect viagetHostConfiguration()
public void startSession(java.lang.String host,
int port,
java.lang.String proxyhost,
int proxyport,
boolean secure)
HostConfiguration
host - the host to connect toport - the port to connect toproxyhost - the proxy host to connect viaproxyport - the proxy port to connect viasecure - whether or not to connect using HTTPSgetHostConfiguration()
public int executeMethod(HttpMethod method)
throws java.io.IOException,
HttpException
HTTP method.method - the HTTP method to execute.
public int executeMethod(HostConfiguration hostConfiguration,
HttpMethod method)
throws java.io.IOException,
HttpException
HTTP method using custom
host configuration.hostConfiguration - The host configuration to use.method - the HTTP method to execute.
public int executeMethod(HostConfiguration hostConfiguration,
HttpMethod method,
HttpState state)
throws java.io.IOException,
HttpException
HTTP method using the given custom
host configuration with the given custom
HTTP state.hostConfiguration - The host configuration to use.method - the HTTP method to execute.state - the HTTP state to use when executing the method.
If null, the state returned by getState() will be used instead.
public void endSession()
throws java.io.IOException
HttpMethod.releaseConnection()
should be used to release resources after a HttpMethod has been executed.
HttpMethod.releaseConnection()public java.lang.String getHost()
null if
the session has not been started via startSession.public int getPort()
public HostConfiguration getHostConfiguration()
host configuration associated with the
HttpClient.host configurationpublic void setHostConfiguration(HostConfiguration hostConfiguration)
host configuration to use with the
HttpClient.hostConfiguration - The host configuration to setpublic HttpConnectionManager getHttpConnectionManager()
HTTP connection manager associated
with the HttpClient.HTTP connection managerpublic void setHttpConnectionManager(HttpConnectionManager httpConnectionManager)
HTTP connection manager to use with
the HttpClient.httpConnectionManager - The HTTP connection manager
to set
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||