Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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.

Nested Class Summary

Nested classes/interfaces inherited from class org.mortbay.jetty.client.HttpExchange
`HttpExchange.CachedExchange, HttpExchange.ContentExchange`

Field Summary
`protected int` | `_contentLength`
`protected java.lang.String` | `_encoding`
`protected java.io.File` | `_fileForUpload`
`protected ByteArrayOutputStream2` | `_responseContent`
`protected int` | `_responseStatus`

Fields inherited from class org.mortbay.jetty.client.CachedExchange
`_responseFields`

Fields inherited from class org.mortbay.jetty.client.HttpExchange
`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 Summary
`ContentExchange()`
`ContentExchange(boolean keepHeaders)`

Method Summary
`java.io.File` | `getFileForUpload()`
`byte[]` | `getResponseBytes()`
`java.lang.String` | `getResponseContent()`
`int` | `getResponseStatus()`
`protected void` | `onResponseContent(Buffer content)` Called for each chunk of the response content received.
`protected void` | `onResponseHeader(Buffer name, Buffer value)` Called for each response header received
`protected void` | `onResponseStatus(Buffer version, int status, 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)`

Methods inherited from class org.mortbay.jetty.client.CachedExchange
`getResponseFields`

Methods inherited from class org.mortbay.jetty.client.HttpExchange
`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`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### _responseStatus

    protected int _responseStatus

### _contentLength

    protected int _contentLength

### _encoding

    protected java.lang.String _encoding

### _responseContent

    protected ByteArrayOutputStream2 _responseContent

### _fileForUpload

    protected java.io.File _fileForUpload

Constructor Detail

### ContentExchange

    public ContentExchange()

### ContentExchange

    public ContentExchange(boolean keepHeaders)

Method Detail

### getResponseStatus

    public int getResponseStatus()

  Overrides:
    `getResponseStatus` in class `CachedExchange`

### getResponseContent

    public java.lang.String getResponseContent()
                                        throws java.io.UnsupportedEncodingException

  Returns:
    The response content as a String
  Throws:
    `java.io.UnsupportedEncodingException`

### getResponseBytes

    public byte[] getResponseBytes()

  Returns:
    The response content as a byte array;

### writeResponseBytesTo

    public void writeResponseBytesTo(java.io.OutputStream out)
                              throws java.io.IOException

  Parameters:
    `out` - An output stream to write the content to.
  Throws:
    `java.io.IOException`

### onResponseStatus

    protected void onResponseStatus(Buffer version,
                                    int status,
                                    Buffer reason)
                             throws java.io.IOException

  Description copied from class: `HttpExchange`
  Called when a response status line has been received.

  Overrides:
    `onResponseStatus` in class `CachedExchange`
  Parameters:
    `version` - HTTP version
    `status` - HTTP status code
    `reason` - HTTP status code reason string
  Throws:
    `java.io.IOException`

### onResponseHeader

    protected void onResponseHeader(Buffer name,
                                    Buffer value)
                             throws java.io.IOException

  Description copied from class: `HttpExchange`
  Called for each response header received

  Overrides:
    `onResponseHeader` in class `CachedExchange`
  Parameters:
    `name` - header name
    `value` - header value
  Throws:
    `java.io.IOException`

### onResponseContent

    protected void onResponseContent(Buffer content)
                              throws java.io.IOException

  Description copied from class: `HttpExchange`
  Called for each chunk of the response content received.

  Overrides:
    `onResponseContent` in class `HttpExchange`
  Throws:
    `java.io.IOException`

### onRetry

    protected void onRetry()
                    throws java.io.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:
    `java.io.IOException`

### getFileForUpload

    public java.io.File getFileForUpload()

### setFileForUpload

    public void setFileForUpload(java.io.File fileForUpload)
                          throws java.io.IOException

  Throws:
    `java.io.IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.