|
||||||||||
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 HttpState
and
one or more HttpConnection
s, to which
HttpMethod
s can be applied.
Constructor Summary | |
HttpClient()
Creates an HttpClient using SimpleHttpConnectionManager . |
|
HttpClient(HttpConnectionManager httpConnectionManager)
Creates an 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 method. |
int |
executeMethod(HostConfiguration hostConfiguration,
HttpMethod method,
HttpState state)
Executes the given method. |
int |
executeMethod(HttpMethod method)
Executes the given method. |
String |
getHost()
Return the host that the client is accessing. |
HostConfiguration |
getHostConfiguration()
Returns the hostConfiguration. |
HttpConnectionManager |
getHttpConnectionManager()
Returns the httpConnectionManager. |
int |
getPort()
Return the port that the client is accessing. |
HttpState |
getState()
Get my state . |
boolean |
isStrictMode()
|
void |
setConnectionTimeout(int newTimeoutInMilliseconds)
Sets the timeout until a connection is etablished. |
void |
setHostConfiguration(HostConfiguration hostConfiguration)
Sets the hostConfiguration. |
void |
setHttpConnectionFactoryTimeout(long timeout)
Sets the timeout used when retrieving an HttpConnection from the HttpConnectionManager. |
void |
setHttpConnectionManager(HttpConnectionManager httpConnectionManager)
Sets the httpConnectionManager. |
void |
setState(HttpState state)
Set my state . |
void |
setStrictMode(boolean strictMode)
|
void |
setTimeout(int newTimeoutInMilliseconds)
Sets the SO_TIMEOUT which is the timeout for waiting for data. |
void |
startSession(String host,
int port)
Deprecated. use hostConfiguration Sets the host, port and protocol(http) to be used when executing a method. |
void |
startSession(String host,
int port,
boolean https)
Deprecated. use hostConfiguration Sets the host, port and protocol to be used when executing a method. |
void |
startSession(String host,
int port,
Credentials creds)
Deprecated. use hostConfiguration and httpState Sets the host, port, protocol(http) and credentials to be used when executing a method. |
void |
startSession(String host,
int port,
Credentials creds,
boolean https)
Deprecated. use hostConfiguration and httpState Sets the host, port, protocol and credentials to be used when executing a method. |
void |
startSession(String host,
int port,
String proxyhost,
int proxyport)
Deprecated. use hostConfiguration Sets the host, port, protocol(http) and proxy to be used when executing a method. |
void |
startSession(String host,
int port,
String proxyhost,
int proxyport,
boolean secure)
Deprecated. use hostConfiguration Sets the host, port, protocol and proxy to be used when executing a method. |
void |
startSession(URI uri)
Deprecated. use hostConfiguration and httpState Sets the host, port, protocol and credentials to be used when executing a method using the server specified by the scheme, userinfo, host and port of the given uri. Note that the path component is not utilized. |
void |
startSession(URL url)
Deprecated. use hostConfiguration Sets the host, port and protocol to be used when executing a method. Note that everything but the protocol, host and port of the given url is ignored. |
void |
startSession(URL url,
Credentials creds)
Deprecated. use hostConfiguration and httpState Sets the host, port, protocol and credentials to be used when executing a method. Note that everything but the protocol, host and port of the given url is ignored. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public HttpClient()
SimpleHttpConnectionManager
.SimpleHttpConnectionManager
public HttpClient(HttpConnectionManager httpConnectionManager)
httpConnectionManager
- The connection manager to use.Method Detail |
public HttpState getState()
state
.setState(HttpState)
public void setState(HttpState state)
state
.state
- the new state for the clientgetState()
public void setStrictMode(boolean strictMode)
strictMode
- true
if strict mode should be usedisStrictMode()
public boolean isStrictMode()
true
if strict mode being usedsetStrictMode(boolean)
public void setTimeout(int newTimeoutInMilliseconds)
newTimeoutInMilliseconds
- Timeout in millisecondspublic void setHttpConnectionFactoryTimeout(long timeout)
timeout
- the timeout in millisecondsHttpConnectionManager.getConnection(HostConfiguration, long)
public void setConnectionTimeout(int newTimeoutInMilliseconds)
newTimeoutInMilliseconds
- Timeout in milliseconds.HttpConnection.setConnectionTimeout(int)
public void startSession(String host, int port)
host
- the host to connect toport
- the port to connect togetHostConfiguration()
public void startSession(String host, int port, boolean https)
host
- the host to connect toport
- the port to connect tohttps
- when true
, create an HTTPS sessiongetHostConfiguration()
public void startSession(String host, int port, Credentials creds)
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(String host, int port, Credentials creds, boolean https)
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, IllegalStateException
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()
,
getState()
public void startSession(URL url) throws IllegalArgumentException
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(URL url, Credentials creds) throws IllegalArgumentException
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(String host, int port, String proxyhost, int proxyport)
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(String host, int port, String proxyhost, int proxyport, boolean secure)
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 IOException, HttpException
method
- the HttpMethod
to execute.public int executeMethod(HostConfiguration hostConfiguration, HttpMethod method) throws IOException, HttpException
hostConfiguration
- The configuration to use.method
- the HttpMethod
to execute.public int executeMethod(HostConfiguration hostConfiguration, HttpMethod method, HttpState state) throws IOException, HttpException
hostConfiguration
- The configuration to use.method
- the HttpMethod
to execute.state
- the HttpState
to use when executing the method.
If null
, the state returned by getState()
will be used instead.public void endSession() throws IOException
HttpMethod.releaseConnection()
public String getHost()
null
if
the session has not been started via startSession.public int getPort()
public HostConfiguration getHostConfiguration()
public void setHostConfiguration(HostConfiguration hostConfiguration)
hostConfiguration
- The hostConfiguration to setpublic HttpConnectionManager getHttpConnectionManager()
public void setHttpConnectionManager(HttpConnectionManager httpConnectionManager)
httpConnectionManager
- The httpConnectionManager to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |