Package org.apache.nutch.protocol.okhttp

# Class OkHttpResponse

java.lang.Object
org.apache.nutch.protocol.okhttp.OkHttpResponse

All Implemented Interfaces:
  `HttpHeaders`, `Response`

public class OkHttpResponse extends Object implements Response

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `OkHttpResponse.TruncatedContent`
  Container to store whether and why content has been truncated

  ## Nested classes/interfaces inherited from interface org.apache.nutch.net.protocols.Response

  `Response.TruncatedContentReason`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final org.slf4j.Logger`
  `LOG`

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

  ### Fields inherited from interface org.apache.nutch.net.protocols.Response

  `CIPHER_SUITES, FETCH_TIME, IP_ADDRESS, PROTOCOL_VERSIONS, REQUEST, RESPONSE_HEADERS, TRUNCATED_CONTENT, TRUNCATED_CONTENT_REASON`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `OkHttpResponse(OkHttp okhttp, URL url, CrawlDatum datum)`

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

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

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

- ## Field Details

  - ### LOG

    protected static final org.slf4j.Logger LOG

- ## Constructor Details

  - ### OkHttpResponse

    public OkHttpResponse(OkHttp okhttp, URL url, CrawlDatum datum) throws ProtocolException, IOException
    Throws:
      `ProtocolException`
      `IOException`

- ## Method Details

  - ### getUrl

    public URL getUrl()
    Description copied from interface: `Response`
    Get the URL the protocol actually used when requesting the Response.
    Specified by:
      `getUrl` in interface `Response`
    Returns:
      `URL`

  - ### getCode

    public int getCode()
    Description copied from interface: `Response`
    Get the response code.
    Specified by:
      `getCode` in interface `Response`
    Returns:
      protocol response code (int)

  - ### getHeader

    public String getHeader(String name)
    Description copied from interface: `Response`
    Get the value of a named header.
    Specified by:
      `getHeader` in interface `Response`
    Parameters:
      `name` - key of the header you wish to retrieve
    Returns:
      header value

  - ### getHeaders

    public Metadata getHeaders()
    Description copied from interface: `Response`
    Get all the headers.
    Specified by:
      `getHeaders` in interface `Response`
    Returns:
      populated headers `Metadata`

  - ### getContent

    public byte[] getContent()
    Description copied from interface: `Response`
    Get the full content of the response.
    Specified by:
      `getContent` in interface `Response`
    Returns:
      a byte array representing the response content