public class ContentExchange extends CachedExchange
HttpExchange.CachedExchange, HttpExchange.ContentExchange
Modifier and Type | Field and Description |
---|---|
protected int |
_contentLength |
protected java.lang.String |
_encoding |
protected java.io.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 |
---|---|
java.io.File |
getFileForUpload() |
byte[] |
getResponseBytes() |
java.lang.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(java.io.File fileForUpload) |
void |
writeResponseBytesTo(java.io.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 java.lang.String _encoding
protected org.mortbay.util.ByteArrayOutputStream2 _responseContent
protected java.io.File _fileForUpload
public ContentExchange()
public ContentExchange(boolean keepHeaders)
public int getResponseStatus()
getResponseStatus
in class CachedExchange
public java.lang.String getResponseContent() throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public byte[] getResponseBytes()
public void writeResponseBytesTo(java.io.OutputStream out) throws java.io.IOException
out
- An output stream to write the content to.java.io.IOException
protected void onResponseStatus(org.mortbay.io.Buffer version, int status, org.mortbay.io.Buffer reason) throws java.io.IOException
HttpExchange
onResponseStatus
in class CachedExchange
version
- HTTP versionstatus
- HTTP status codereason
- HTTP status code reason stringjava.io.IOException
protected void onResponseHeader(org.mortbay.io.Buffer name, org.mortbay.io.Buffer value) throws java.io.IOException
HttpExchange
onResponseHeader
in class CachedExchange
name
- header namevalue
- header valuejava.io.IOException
protected void onResponseContent(org.mortbay.io.Buffer content) throws java.io.IOException
HttpExchange
onResponseContent
in class HttpExchange
java.io.IOException
protected void onRetry() throws java.io.IOException
HttpExchange
onRetry
in class HttpExchange
java.io.IOException
public java.io.File getFileForUpload()
public void setFileForUpload(java.io.File fileForUpload) throws java.io.IOException
java.io.IOException
Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.