org.eclipse.jetty.client

## Class CachedExchange

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

- Direct Known Subclasses:
    ContentExchange, HttpExchange.CachedExchange, MkcolExchange

      public class CachedExchange
      extends HttpExchange

  An exchange that retains response status and response headers 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
    `CachedExchange(boolean cacheHeaders)` Creates a new CachedExchange.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `HttpFields` | `getResponseFields()`
    `int` | `getResponseStatus()`
    `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.

    - ### 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, onResponseContent, onResponseHeaderComplete, onRetry, 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

    - #### CachedExchange

          public CachedExchange(boolean cacheHeaders)

      Creates a new CachedExchange.
      Parameters:
        `cacheHeaders` - true to cache response headers, false to not cache them

  - ### Method Detail

    - #### getResponseStatus

          public int getResponseStatus()

    - #### getResponseFields

          public HttpFields getResponseFields()

    - #### 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 `HttpExchange`
      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 `HttpExchange`
      Parameters:
        `name` - the header name
        `value` - the header value
      Throws:
        `IOException` - allowed to be thrown by overriding code

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