Package org.apache.nutch.net.protocols

# Interface Response

All Superinterfaces:
  `HttpHeaders`

All Known Implementing Classes:
  `HttpResponse`, `HttpResponse`, `HttpResponse`, `HttpResponse`, `HttpResponse`, `OkHttpResponse`

public interface Response extends HttpHeaders
A response interface. Makes all protocols model HTTP.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static enum`
  `Response.TruncatedContentReason`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `CIPHER_SUITES`
  Key to hold the SSL/TLS cipher suites `store.protocol.versions` is true.
  `static final String`
  `FETCH_TIME`
  Key to hold the time when the page has been fetched
  `static final String`
  `IP_ADDRESS`
  Key to hold the IP address the request is sent to if `store.ip.address` is true
  `static final String`
  `PROTOCOL_VERSIONS`
  Key to hold the HTTP and SSL/TLS protocol versions if `store.protocol.versions` is true.
  `static final String`
  `REQUEST`
  Key to hold the HTTP request if `store.http.request` is true
  `static final String`
  `RESPONSE_HEADERS`
  Key to hold the HTTP response header if `store.http.headers` is true
  `static final String`
  `TRUNCATED_CONTENT`
  Key to hold boolean whether content has been truncated, e.g., because it exceeds `http.content.limit`
  `static final String`
  `TRUNCATED_CONTENT_REASON`
  Key to hold reason why content has been truncated, see `Response.TruncatedContentReason`

  ### Fields inherited from interface org.apache.nutch.metadata.HttpHeaders

  `CLIENT_TRANSFER_ENCODING, CONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_MD5, CONTENT_TYPE, IF_MODIFIED_SINCE, LAST_MODIFIED, LOCATION, TRANSFER_ENCODING, USER_AGENT, WRITABLE_CONTENT_TYPE`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getCode()`
  Get the response code.
  `byte[]`
  `getContent()`
  Get the full content of the response.
  `String`
  `getHeader(String name)`
  Get the value of a named header.
  `Metadata`
  `getHeaders()`
  Get all the headers.
  `URL`
  `getUrl()`
  Get the URL the protocol actually used when requesting the Response.

- ## Field Details

  - ### REQUEST

    static final String REQUEST
    Key to hold the HTTP request if `store.http.request` is true
    See Also:
      - Constant Field Values

  - ### RESPONSE_HEADERS

    static final String RESPONSE_HEADERS
    Key to hold the HTTP response header if `store.http.headers` is true
    See Also:
      - Constant Field Values

  - ### IP_ADDRESS

    static final String IP_ADDRESS
    Key to hold the IP address the request is sent to if `store.ip.address` is true
    See Also:
      - Constant Field Values

  - ### PROTOCOL_VERSIONS

    static final String PROTOCOL_VERSIONS
    Key to hold the HTTP and SSL/TLS protocol versions if `store.protocol.versions` is true.
    See Also:
      - Constant Field Values

  - ### CIPHER_SUITES

    static final String CIPHER_SUITES
    Key to hold the SSL/TLS cipher suites `store.protocol.versions` is true.
    See Also:
      - Constant Field Values

  - ### FETCH_TIME

    static final String FETCH_TIME
    Key to hold the time when the page has been fetched
    See Also:
      - Constant Field Values

  - ### TRUNCATED_CONTENT

    static final String TRUNCATED_CONTENT
    Key to hold boolean whether content has been truncated, e.g., because it exceeds `http.content.limit`
    See Also:
      - Constant Field Values

  - ### TRUNCATED_CONTENT_REASON

    static final String TRUNCATED_CONTENT_REASON
    Key to hold reason why content has been truncated, see `Response.TruncatedContentReason`
    See Also:
      - Constant Field Values

- ## Method Details

  - ### getUrl

    URL getUrl()
    Get the URL the protocol actually used when requesting the Response.
    Returns:
      `URL`

  - ### getCode

    int getCode()
    Get the response code.
    Returns:
      protocol response code (int)

  - ### getHeader

    String getHeader(String name)
    Get the value of a named header.
    Parameters:
      `name` - key of the header you wish to retrieve
    Returns:
      header value

  - ### getHeaders

    Metadata getHeaders()
    Get all the headers.
    Returns:
      populated headers `Metadata`

  - ### getContent

    byte[] getContent()
    Get the full content of the response.
    Returns:
      a byte array representing the response content