org.mortbay.jetty.client
Class ContentExchange
java.lang.Object
org.mortbay.jetty.client.HttpExchange
org.mortbay.jetty.client.CachedExchange
org.mortbay.jetty.client.ContentExchange
- Direct Known Subclasses:
- BayeuxClient.Exchange, HttpExchange.ContentExchange
public class ContentExchange
- extends CachedExchange
A CachedExchange that retains response content for later use.
Methods inherited from class org.mortbay.jetty.client.HttpExchange |
addRequestHeader, addRequestHeader, cancel, configureListeners, getAddress, getEventListener, getMethod, getRequestContent, getRequestContentChunk, getRequestContentSource, getRequestFields, getRetryStatus, getScheme, getStatus, getURI, getVersion, isDone, onConnectionFailed, onException, onExpire, onRequestCommitted, onRequestComplete, onResponseComplete, onResponseHeaderComplete, reset, setAddress, setConfigureListeners, setEventListener, setMethod, setRequestContent, setRequestContentSource, setRequestContentType, setRequestHeader, setRequestHeader, setRetryStatus, setScheme, setURI, setURL, setVersion, setVersion, toString, waitForDone, waitForStatus |
_responseStatus
protected int _responseStatus
_contentLength
protected int _contentLength
_encoding
protected String _encoding
_responseContent
protected ByteArrayOutputStream2 _responseContent
_fileForUpload
protected File _fileForUpload
ContentExchange
public ContentExchange()
ContentExchange
public ContentExchange(boolean keepHeaders)
getResponseStatus
public int getResponseStatus()
- Overrides:
getResponseStatus
in class CachedExchange
getResponseContent
public String getResponseContent()
throws UnsupportedEncodingException
- Returns:
- The response content as a String
- Throws:
UnsupportedEncodingException
getResponseBytes
public byte[] getResponseBytes()
- Returns:
- The response content as a byte array;
writeResponseBytesTo
public void writeResponseBytesTo(OutputStream out)
throws IOException
- Parameters:
out
- An output stream to write the content to.
- Throws:
IOException
onResponseStatus
protected void onResponseStatus(Buffer version,
int status,
Buffer reason)
throws IOException
- Description copied from class:
HttpExchange
- Called when a response status line has been received.
- Overrides:
onResponseStatus
in class CachedExchange
- Parameters:
version
- HTTP versionstatus
- HTTP status codereason
- HTTP status code reason string
- Throws:
IOException
onResponseHeader
protected void onResponseHeader(Buffer name,
Buffer value)
throws IOException
- Description copied from class:
HttpExchange
- Called for each response header received
- Overrides:
onResponseHeader
in class CachedExchange
- Parameters:
name
- header namevalue
- header value
- Throws:
IOException
onResponseContent
protected void onResponseContent(Buffer content)
throws IOException
- Description copied from class:
HttpExchange
- Called for each chunk of the response content received.
- Overrides:
onResponseContent
in class HttpExchange
- Throws:
IOException
onRetry
protected void onRetry()
throws IOException
- Description copied from class:
HttpExchange
- Called when the request is retried (due to failures or authentication).
Implementations may need to reset any consumable content that needs to
be sent.
- Overrides:
onRetry
in class HttpExchange
- Throws:
IOException
getFileForUpload
public File getFileForUpload()
setFileForUpload
public void setFileForUpload(File fileForUpload)
throws IOException
- Throws:
IOException
Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.