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 |
_responseFields
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 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) |
getResponseFields
addRequestHeader, 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, waitForStatus
protected 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 CachedExchange
public String getResponseContent() throws UnsupportedEncodingException
UnsupportedEncodingException
public byte[] getResponseBytes()
public void writeResponseBytesTo(OutputStream out) throws IOException
out
- An output stream to write the content to.IOException
protected void onResponseStatus(org.mortbay.io.Buffer version, int status, org.mortbay.io.Buffer reason) throws IOException
HttpExchange
onResponseStatus
in class CachedExchange
version
- HTTP versionstatus
- HTTP status codereason
- HTTP status code reason stringIOException
protected void onResponseHeader(org.mortbay.io.Buffer name, org.mortbay.io.Buffer value) throws IOException
HttpExchange
onResponseHeader
in class CachedExchange
name
- header namevalue
- header valueIOException
protected void onResponseContent(org.mortbay.io.Buffer content) throws IOException
HttpExchange
onResponseContent
in class HttpExchange
IOException
protected void onRetry() throws IOException
HttpExchange
onRetry
in class HttpExchange
IOException
public File getFileForUpload()
public void setFileForUpload(File fileForUpload) throws IOException
IOException
Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.