public class ContentExchange extends CachedExchange
HttpExchange.CachedExchange, HttpExchange.ContentExchange
STATUS_CANCELLED, STATUS_CANCELLING, STATUS_COMPLETED, STATUS_EXCEPTED, STATUS_EXPIRED, STATUS_PARSING_CONTENT, STATUS_PARSING_HEADERS, STATUS_SENDING_REQUEST, STATUS_START, STATUS_WAITING_FOR_COMMIT, STATUS_WAITING_FOR_CONNECTION, STATUS_WAITING_FOR_RESPONSE
Constructor and Description |
---|
ContentExchange() |
ContentExchange(boolean cacheFields) |
Modifier and Type | Method and Description |
---|---|
File |
getFileForUpload() |
String |
getResponseContent() |
byte[] |
getResponseContentBytes() |
protected void |
onResponseContent(Buffer content)
Callback called for each chunk of the response content received from the server.
|
protected void |
onResponseHeader(Buffer name,
Buffer value)
Callback called for each response header received from the server.
|
protected void |
onResponseStatus(Buffer version,
int status,
Buffer reason)
Callback called when a response status line has been received from the server.
|
protected void |
onRetry()
Callback called when the request is retried (due to failures or authentication).
|
void |
setFileForUpload(File fileForUpload) |
getResponseFields, getResponseStatus
addRequestHeader, addRequestHeader, cancel, cancelTimeout, configureListeners, expire, getAddress, getEventListener, getLocalAddress, getMethod, getRequestContent, getRequestContentChunk, getRequestContentSource, getRequestFields, getRequestURI, getRetryStatus, getScheme, getStatus, getTimeout, getURI, getVersion, isDone, isDone, onConnectionFailed, onException, onExpire, onRequestCommitted, onRequestComplete, onResponseComplete, onResponseHeaderComplete, onSwitchProtocol, reset, scheduleTimeout, setAddress, setConfigureListeners, setEventListener, setMethod, setRequestContent, setRequestContentSource, setRequestContentType, setRequestHeader, setRequestHeader, setRequestURI, setRetryStatus, setScheme, setScheme, setTimeout, setURI, setURI, setURL, setVersion, setVersion, toState, toString, waitForDone, waitForStatus
public ContentExchange()
public ContentExchange(boolean cacheFields)
public String getResponseContent() throws UnsupportedEncodingException
UnsupportedEncodingException
public byte[] getResponseContentBytes()
protected void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException
HttpExchange
onResponseStatus
in class CachedExchange
version
- the HTTP versionstatus
- the HTTP status codereason
- the HTTP status reason stringIOException
- allowed to be thrown by overriding codeprotected void onResponseHeader(Buffer name, Buffer value) throws IOException
HttpExchange
onResponseHeader
in class CachedExchange
name
- the header namevalue
- the header valueIOException
- allowed to be thrown by overriding codeprotected void onResponseContent(Buffer content) throws IOException
HttpExchange
onResponseContent
in class HttpExchange
content
- the buffer holding the content chunkIOException
- allowed to be thrown by overriding codeprotected void onRetry() throws IOException
HttpExchange
onRetry
in class HttpExchange
IOException
- allowed to be thrown by overriding codepublic File getFileForUpload()
public void setFileForUpload(File fileForUpload) throws IOException
IOException
Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.