org.apache.nutch.protocol.httpclient

## Class Http

- java.lang.Object
- - org.apache.nutch.protocol.http.api.HttpBase
  - - org.apache.nutch.protocol.httpclient.Http

- All Implemented Interfaces:
    Configurable, FieldPluggable, Pluggable, Protocol

      public class Http
      extends HttpBase

  This class is a protocol plugin that configures an HTTP client for Basic, Digest and NTLM authentication schemes for web server as well as proxy server. It takes care of HTTPS protocol as well as cookies in a single fetch session.
  Author:
    Susam Pal

- - ### Field Summary

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

    - ### Fields inherited from class org.apache.nutch.protocol.http.api.HttpBase

      `accept, acceptCharset, acceptLanguage, BUFFER_SIZE, maxContent, proxyHost, proxyPort, responseTime, timeout, tlsPreferredCipherSuites, tlsPreferredProtocols, useHttp11, useProxy, userAgent`

    - ### Fields inherited from interface org.apache.nutch.protocol.Protocol

      `CHECK_BLOCKING, CHECK_ROBOTS, X_POINT_ID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Http()` Constructs this plugin.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Collection<WebPage.Field>` | `getFields()`
    `protected Response` | `getResponse(java.net.URL url, WebPage page, boolean redirect)` Fetches the `url` with a configured HTTP client and gets the response.
    `static void` | `main(java.lang.String[] args)` Main method.
    `void` | `setConf(Configuration conf)` Reads the configuration from the Nutch configuration files and sets the configuration.

    - ### Methods inherited from class org.apache.nutch.protocol.http.api.HttpBase

      `getAccept, getAcceptCharset, getAcceptLanguage, getConf, getMaxContent, getProtocolOutput, getProxyHost, getProxyPort, getRobotRules, getTimeout, getTlsPreferredCipherSuites, getTlsPreferredProtocols, getUseHttp11, getUserAgent, logConf, main, processDeflateEncoded, processGzipEncoded, useProxy`

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

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

- - ### Field Detail

    - #### LOG

          protected static final org.slf4j.Logger LOG

  - ### Constructor Detail

    - #### Http

          public Http()

      Constructs this plugin.

  - ### Method Detail

    - #### getFields

          public java.util.Collection<WebPage.Field> getFields()

    - #### setConf

          public void setConf(Configuration conf)

      Reads the configuration from the Nutch configuration files and sets the configuration.
      Specified by:
        `setConf` in interface `Configurable`
      Overrides:
        `setConf` in class `HttpBase`
      Parameters:
        `conf` - Configuration

    - #### main

          public static void main(java.lang.String[] args)
                           throws java.lang.Exception

      Main method.
      Parameters:
        `args` - Command line arguments
      Throws:
        `java.lang.Exception`

    - #### getResponse

          protected Response getResponse(java.net.URL url,
                                         WebPage page,
                                         boolean redirect)
                                  throws ProtocolException,
                                         java.io.IOException

      Fetches the `url` with a configured HTTP client and gets the response.
      Specified by:
        `getResponse` in class `HttpBase`
      Parameters:
        `url` - URL to be fetched
        `page` - `WebPage` object relative to the URL
        `redirect` - Follow redirects if and only if true
      Returns:
        HTTP response
      Throws:
        `ProtocolException`
        `java.io.IOException`

Copyright © 2019 The Apache Software Foundation