|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jetty.client.HttpExchange
public class HttpExchange
An HTTP client API that encapsulates Exchange with a HTTP server. This object encapsulates:
#setAddress(InetSocketAddress)
or setURL(String)
)
setMethod(String)
, setURI(String)
, and setVersion(int)
addRequestHeader(String, String)
or setRequestHeader(String, String)
)
setRequestContent(Buffer)
or setRequestContentSource(InputStream)
)
getStatus()
)
onRequestComplete()
or onResponseComplete()
)
setEventListener(HttpEventListener)
ContentExchange
and HttpExchange.CachedExchange
.
Typically the HttpExchange is passed to a the HttpClient.send(HttpExchange)
method, which in
turn selects a HttpDestination
and calls it's HttpDestination#send(HttpExchange), which
then creates or selects a {@link HttpConnection} and calls its {@link HttpConnection#send(HttpExchange).
A developer may wish to directly call send on the destination or connection if they wish to bypass
some handling provided (eg Cookie handling in the HttpDestination).
In some circumstances, the HttpClient or HttpDestination may wish to retry a HttpExchange (eg. failed pipeline request, authentication retry or redirection). In such cases, the HttpClient and/or HttpDestination may insert their own HttpExchangeListener to intercept and filter the call backs intended for the HttpExchange.
Nested Class Summary | |
---|---|
static class |
HttpExchange.CachedExchange
Deprecated. use CachedExchange |
static class |
HttpExchange.ContentExchange
Deprecated. use ContentExchange |
Field Summary | |
---|---|
static int |
STATUS_COMPLETED
|
static int |
STATUS_EXCEPTED
|
static int |
STATUS_EXPIRED
|
static int |
STATUS_PARSING_CONTENT
|
static int |
STATUS_PARSING_HEADERS
|
static int |
STATUS_SENDING_REQUEST
|
static int |
STATUS_START
|
static int |
STATUS_WAITING_FOR_COMMIT
|
static int |
STATUS_WAITING_FOR_CONNECTION
|
static int |
STATUS_WAITING_FOR_RESPONSE
|
Constructor Summary | |
---|---|
HttpExchange()
|
Method Summary | |
---|---|
void |
addRequestHeader(Buffer name,
Buffer value)
|
void |
addRequestHeader(String name,
String value)
|
void |
cancel()
Cancel this exchange Currently this implementation does nothing. |
boolean |
configureListeners()
true of the exchange should have listeners configured for it by the destination false if this is being managed elsewhere |
Address |
getAddress()
|
HttpEventListener |
getEventListener()
|
String |
getMethod()
|
Buffer |
getRequestContent()
|
Buffer |
getRequestContentChunk()
|
InputStream |
getRequestContentSource()
|
HttpFields |
getRequestFields()
|
boolean |
getRetryStatus()
|
Buffer |
getScheme()
|
int |
getStatus()
|
String |
getURI()
|
int |
getVersion()
|
boolean |
isDone(int status)
|
protected void |
onConnectionFailed(Throwable ex)
|
protected void |
onException(Throwable ex)
|
protected void |
onExpire()
|
protected void |
onRequestCommitted()
|
protected void |
onRequestComplete()
|
protected void |
onResponseComplete()
|
protected void |
onResponseContent(Buffer content)
|
protected void |
onResponseHeader(Buffer name,
Buffer value)
|
protected void |
onResponseHeaderComplete()
|
protected void |
onResponseStatus(Buffer version,
int status,
Buffer reason)
|
protected void |
onRetry()
|
void |
reset()
|
void |
setAddress(Address address)
|
void |
setConfigureListeners(boolean autoConfigure)
|
void |
setEventListener(HttpEventListener listener)
|
void |
setMethod(String method)
|
void |
setRequestContent(Buffer requestContent)
|
void |
setRequestContentSource(InputStream in)
|
void |
setRequestContentType(String value)
|
void |
setRequestHeader(Buffer name,
Buffer value)
|
void |
setRequestHeader(String name,
String value)
|
void |
setRetryStatus(boolean retryStatus)
|
void |
setScheme(Buffer scheme)
|
void |
setURI(String uri)
|
void |
setURL(String url)
|
void |
setVersion(int version)
|
void |
setVersion(String version)
|
String |
toString()
|
int |
waitForDone()
|
void |
waitForStatus(int status)
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int STATUS_START
public static final int STATUS_WAITING_FOR_CONNECTION
public static final int STATUS_WAITING_FOR_COMMIT
public static final int STATUS_SENDING_REQUEST
public static final int STATUS_WAITING_FOR_RESPONSE
public static final int STATUS_PARSING_HEADERS
public static final int STATUS_PARSING_CONTENT
public static final int STATUS_COMPLETED
public static final int STATUS_EXPIRED
public static final int STATUS_EXCEPTED
Constructor Detail |
---|
public HttpExchange()
Method Detail |
---|
public int getStatus()
public void waitForStatus(int status) throws InterruptedException
InterruptedException
public int waitForDone() throws InterruptedException
InterruptedException
public void reset()
public boolean isDone(int status)
public HttpEventListener getEventListener()
public void setEventListener(HttpEventListener listener)
public void setURL(String url)
url
- Including protocol, host and portpublic void setAddress(Address address)
address
- public Address getAddress()
public void setScheme(Buffer scheme)
scheme
- public Buffer getScheme()
public void setVersion(int version)
version
- as integer, 9, 10 or 11 for 0.9, 1.0 or 1.1public void setVersion(String version)
public int getVersion()
public void setMethod(String method)
method
- public String getMethod()
public String getURI()
public void setURI(String uri)
uri
- public void addRequestHeader(String name, String value)
name
- value
- public void addRequestHeader(Buffer name, Buffer value)
name
- value
- public void setRequestHeader(String name, String value)
name
- value
- public void setRequestHeader(Buffer name, Buffer value)
name
- value
- public void setRequestContentType(String value)
value
- public HttpFields getRequestFields()
public void setRequestContent(Buffer requestContent)
requestContent
- public void setRequestContentSource(InputStream in)
in
- public InputStream getRequestContentSource()
public Buffer getRequestContentChunk() throws IOException
IOException
public Buffer getRequestContent()
public boolean getRetryStatus()
public void setRetryStatus(boolean retryStatus)
public void cancel()
public String toString()
toString
in class Object
protected void onRequestCommitted() throws IOException
IOException
protected void onRequestComplete() throws IOException
IOException
protected void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException
IOException
protected void onResponseHeader(Buffer name, Buffer value) throws IOException
IOException
protected void onResponseHeaderComplete() throws IOException
IOException
protected void onResponseContent(Buffer content) throws IOException
IOException
protected void onResponseComplete() throws IOException
IOException
protected void onConnectionFailed(Throwable ex)
protected void onException(Throwable ex)
protected void onExpire()
protected void onRetry() throws IOException
IOException
public boolean configureListeners()
public void setConfigureListeners(boolean autoConfigure)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |