org.eclipse.jetty.client

## Class ContentExchange

- java.lang.Object
- - org.eclipse.jetty.client.HttpExchange
  - - org.eclipse.jetty.client.CachedExchange
    - - org.eclipse.jetty.client.ContentExchange

- Direct Known Subclasses:
    HttpExchange.ContentExchange

      public class ContentExchange
      extends CachedExchange

  A exchange that retains response content for later use.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.eclipse.jetty.client.HttpExchange

      `HttpExchange.CachedExchange, HttpExchange.ContentExchange`

  - ### Field Summary

    - ### Fields inherited from class org.eclipse.jetty.client.HttpExchange

      `STATUS_CANCELLED, STATUS_CANCELLING, STATUS_COMPLETED, STATUS_EXCEPTED, STATUS_EXPIRED, STATUS_PARSING_CONTENT, STATUS_PARSING_HEADERS, STATUS_SENDING_COMPLETED, STATUS_SENDING_PARSING_CONTENT, STATUS_SENDING_PARSING_HEADERS, STATUS_SENDING_REQUEST, STATUS_START, STATUS_WAITING_FOR_COMMIT, STATUS_WAITING_FOR_CONNECTION, STATUS_WAITING_FOR_RESPONSE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ContentExchange()`
    `ContentExchange(boolean cacheFields)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `File` | `getFileForUpload()`
    `String` | `getResponseContent()`
    `byte[]` | `getResponseContentBytes()`
    `protected void` | `onResponseContent(Buffer content)` Callback called for each chunk of the response content received from the server.
    `protected void` | `onResponseHeader(Buffer name, Buffer value)` Callback called for each response header received from the server.
    `protected void` | `onResponseStatus(Buffer version, int status, Buffer reason)` Callback called when a response status line has been received from the server.
    `protected void` | `onRetry()` Callback called when the request is retried (due to failures or authentication).
    `void` | `setFileForUpload(File fileForUpload)`

    - ### Methods inherited from class org.eclipse.jetty.client.CachedExchange

      `getResponseFields, getResponseStatus`

    - ### Methods inherited from class org.eclipse.jetty.client.HttpExchange

      `addRequestHeader, addRequestHeader, cancel, cancelTimeout, configureListeners, expire, getAddress, getEventListener, getLocalAddress, getMethod, getRequestContent, getRequestContentChunk, getRequestContentSource, getRequestFields, getRequestURI, getRetryStatus, getScheme, getStatus, getTimeout, getURI, getVersion, isDone, isDone, onConnectionFailed, onException, onExpire, onRequestCommitted, onRequestComplete, onResponseComplete, onResponseHeaderComplete, onSwitchProtocol, reset, scheduleTimeout, setAddress, setConfigureListeners, setEventListener, setMethod, setRequestContent, setRequestContentSource, setRequestContentType, setRequestHeader, setRequestHeader, setRequestURI, setRetryStatus, setScheme, setScheme, setTimeout, setURI, setURI, setURL, setVersion, setVersion, toState, toString, waitForDone, waitForStatus`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ContentExchange

          public ContentExchange()

    - #### ContentExchange

          public ContentExchange(boolean cacheFields)

  - ### Method Detail

    - #### getResponseContent

          public String getResponseContent()
                                    throws UnsupportedEncodingException

      Throws:
        `UnsupportedEncodingException`

    - #### getResponseContentBytes

          public byte[] getResponseContentBytes()

    - #### onResponseStatus

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

      Description copied from class: `HttpExchange`
      Callback called when a response status line has been received from the server. This implementation does nothing.
      Overrides:
        `onResponseStatus` in class `CachedExchange`
      Parameters:
        `version` - the HTTP version
        `status` - the HTTP status code
        `reason` - the HTTP status reason string
      Throws:
        `IOException` - allowed to be thrown by overriding code

    - #### onResponseHeader

          protected void onResponseHeader(Buffer name,
                              Buffer value)
                                   throws IOException

      Description copied from class: `HttpExchange`
      Callback called for each response header received from the server. This implementation does nothing.
      Overrides:
        `onResponseHeader` in class `CachedExchange`
      Parameters:
        `name` - the header name
        `value` - the header value
      Throws:
        `IOException` - allowed to be thrown by overriding code

    - #### onResponseContent

          protected void onResponseContent(Buffer content)
                                    throws IOException

      Description copied from class: `HttpExchange`
      Callback called for each chunk of the response content received from the server. This implementation does nothing.
      Overrides:
        `onResponseContent` in class `HttpExchange`
      Parameters:
        `content` - the buffer holding the content chunk
      Throws:
        `IOException` - allowed to be thrown by overriding code

    - #### onRetry

          protected void onRetry()
                          throws IOException

      Description copied from class: `HttpExchange`
      Callback called when the request is retried (due to failures or authentication). Implementations must reset any consumable content that needs to be sent.
      Overrides:
        `onRetry` in class `HttpExchange`
      Throws:
        `IOException` - allowed to be thrown by overriding code

    - #### getFileForUpload

          public File getFileForUpload()

    - #### setFileForUpload

          public void setFileForUpload(File fileForUpload)
                                throws IOException

      Throws:
        `IOException`

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