|
|||||||||
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()
Constructor. |
Method Summary | |
void |
endSession()
End the current session, closing my the associated connection if any. |
int |
executeMethod(HttpMethod method)
Execute the given HttpMethod using my current
connection and HttpState . |
HttpState |
getState()
Get my state . |
void |
setSSLSocketFactory(javax.net.ssl.SSLSocketFactory sslSocketFactory)
Specifies an alternative factory for SSL sockets. |
void |
setState(HttpState state)
Set my state . |
void |
setTimeout(int newTimeoutInMilliseconds)
Sets the SO_TIMEOUT which is the timeout for waiting for data. |
void |
startSession(java.lang.String host,
int port)
Start an HTTP session with the server at the given host and port. |
void |
startSession(java.lang.String host,
int port,
boolean https)
Start an HTTP or HTTPS session with the server at the given host and port. |
void |
startSession(java.lang.String host,
int port,
Credentials creds)
Start an HTTP session with the server at the given host and port using the given default default credentials. |
void |
startSession(java.lang.String host,
int port,
Credentials creds,
boolean https)
Start an HTTP or HTTPS session with the server at the given host and port using the given default default credentials. |
void |
startSession(java.lang.String host,
int port,
java.lang.String proxyhost,
int proxyport)
Start an HTTP session with the server specified by the given host and port via the given proxyhost and proxyport. |
void |
startSession(java.lang.String host,
int port,
java.lang.String proxyhost,
int proxyport,
boolean secure)
Start an HTTP session with the server specified by the given host and port via the given proxyhost and proxyport. |
void |
startSession(java.net.URL url)
Start an HTTP or HTTPS session with the server specified by the protocol, host and port of the given url. |
void |
startSession(java.net.URL url,
Credentials creds)
Start an HTTP or HTTPS session with the server specified by the protocol, host and port of the given url, using the given credentials by default. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HttpClient()
Method Detail |
public HttpState getState()
state
.setState(HttpState)
public void setState(HttpState state)
state
.state
- the new state for the clientgetState()
public void setSSLSocketFactory(javax.net.ssl.SSLSocketFactory sslSocketFactory)
sslSocketFactory
- a living instance of the alternative SSLSocketFactoryHttpConnection.setSSLSocketFactory
public void setTimeout(int newTimeoutInMilliseconds)
newTimeoutInMilliseconds
- Timeout in millisecondspublic void startSession(java.lang.String host, int port)
host
- the host to connect toport
- the port to connect toendSession()
public void startSession(java.lang.String host, int port, boolean https)
host
- the host to connect toport
- the port to connect tohttps
- when true
, create an HTTPS sessionendSession()
public void startSession(java.lang.String host, int port, Credentials creds)
host
- the host to connect toport
- the port to connect tocreds
- the default credentials to useendSession()
public void startSession(java.lang.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 sessionendSession()
public void startSession(java.net.URL url)
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 determinedendSession()
public void startSession(java.net.URL url, Credentials creds)
Note that everything but the protocol, host and port of the given url is ignored.
creds
- the default credentials to useurl
- the URL
from which the protocol, host,
and port of the session are determinedendSession()
public void startSession(java.lang.String host, int port, java.lang.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 viaendSession()
public void startSession(java.lang.String host, int port, java.lang.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 HTTPSendSession()
public int executeMethod(HttpMethod method) throws java.io.IOException, HttpException, java.lang.IllegalStateException
HttpMethod
using my current
connection
and HttpState
.method
- the HttpMethod
to executejava.io.IOException
- if an I/O error occursHttpException
- if a protocol exception occursjava.lang.IllegalStateException
- if the session has not been startedpublic void endSession() throws java.io.IOException
connection
if any.java.io.IOException
- when i/o errors occur closing the connectionstartSession(String, int)
,
startSession(String, int, boolean)
,
startSession(String, int, Credentials)
,
startSession(String, int, Credentials, boolean)
,
startSession(java.net.URL)
,
startSession(java.net.URL, Credentials)
,
startSession(String, int, String, int)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |