public class ContentExchange extends CachedExchange
HttpExchange.CachedExchange, HttpExchange.ContentExchange| Modifier and Type | Field and Description |
|---|---|
protected int |
_contentLength |
protected String |
_encoding |
protected File |
_fileForUpload |
protected org.mortbay.util.ByteArrayOutputStream2 |
_responseContent |
protected int |
_responseStatus |
_responseFieldsSTATUS_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 keepHeaders) |
| Modifier and Type | Method and Description |
|---|---|
File |
getFileForUpload() |
byte[] |
getResponseBytes() |
String |
getResponseContent() |
int |
getResponseStatus() |
protected void |
onResponseContent(org.mortbay.io.Buffer content)
Called for each chunk of the response content received.
|
protected void |
onResponseHeader(org.mortbay.io.Buffer name,
org.mortbay.io.Buffer value)
Called for each response header received
|
protected void |
onResponseStatus(org.mortbay.io.Buffer version,
int status,
org.mortbay.io.Buffer reason)
Called when a response status line has been received.
|
protected void |
onRetry()
Called when the request is retried (due to failures or authentication).
|
void |
setFileForUpload(File fileForUpload) |
void |
writeResponseBytesTo(OutputStream out) |
getResponseFieldsaddRequestHeader, addRequestHeader, cancel, configureListeners, getAddress, getEventListener, getMethod, getRequestContent, getRequestContentChunk, getRequestContentSource, getRequestFields, getRetryStatus, getScheme, getStatus, getTimeout, getURI, getVersion, isDone, onConnectionFailed, onException, onExpire, onRequestCommitted, onRequestComplete, onResponseComplete, onResponseHeaderComplete, reset, setAddress, setConfigureListeners, setEventListener, setMethod, setRequestContent, setRequestContentSource, setRequestContentType, setRequestHeader, setRequestHeader, setRetryStatus, setScheme, setTimeout, setURI, setURL, setVersion, setVersion, toString, waitForDone, waitForStatusprotected int _responseStatus
protected int _contentLength
protected String _encoding
protected org.mortbay.util.ByteArrayOutputStream2 _responseContent
protected File _fileForUpload
public ContentExchange()
public ContentExchange(boolean keepHeaders)
public int getResponseStatus()
getResponseStatus in class CachedExchangepublic String getResponseContent() throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic byte[] getResponseBytes()
public void writeResponseBytesTo(OutputStream out) throws IOException
out - An output stream to write the content to.IOExceptionprotected void onResponseStatus(org.mortbay.io.Buffer version,
int status,
org.mortbay.io.Buffer reason)
throws IOException
HttpExchangeonResponseStatus in class CachedExchangeversion - HTTP versionstatus - HTTP status codereason - HTTP status code reason stringIOExceptionprotected void onResponseHeader(org.mortbay.io.Buffer name,
org.mortbay.io.Buffer value)
throws IOException
HttpExchangeonResponseHeader in class CachedExchangename - header namevalue - header valueIOExceptionprotected void onResponseContent(org.mortbay.io.Buffer content)
throws IOException
HttpExchangeonResponseContent in class HttpExchangeIOExceptionprotected void onRetry()
throws IOException
HttpExchangeonRetry in class HttpExchangeIOExceptionpublic File getFileForUpload()
public void setFileForUpload(File fileForUpload) throws IOException
IOExceptionCopyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.