Class HttpSnifferConfig

java.lang.Object
com.norconex.crawler.web.fetch.impl.webdriver.HttpSnifferConfig

public class HttpSnifferConfig extends Object

Configuration for HttpSniffer.

  • Field Details

    • DEFAULT_MAX_BUFFER_SIZE

      public static final int DEFAULT_MAX_BUFFER_SIZE
    • DEFAULT_RESPONSE_TIMEOUT

      public static final Duration DEFAULT_RESPONSE_TIMEOUT
  • Constructor Details

    • HttpSnifferConfig

      public HttpSnifferConfig()
  • Method Details

    • getRequestHeaders

      public Map<String,String> getRequestHeaders()
      Gets the request headers to add to every HTTP request.
      Returns:
      map of request headers
    • setRequestHeaders

      public HttpSnifferConfig setRequestHeaders(Map<String,String> requestHeaders)
      Sets the request headers to add to every HTTP request.
      Parameters:
      requestHeaders - map of request headers
      Returns:
      this
    • getChainedProxy

      public ProxySettings getChainedProxy()
      Gets chained proxy settings, if any. That is, when the sniffer proxy has to itself use a proxy.
      Returns:
      chained proxy settings
    • setChainedProxy

      public HttpSnifferConfig setChainedProxy(ProxySettings chainedProxy)
      Sets chained proxy settings, if any. That is, when the sniffer proxy has to itself use a proxy.
      Parameters:
      chainedProxy - chained proxy settings
      Returns:
      this
    • getPort

      public int getPort()
      The host port passed to the browser pointing to the sniffer proxy. Defaults to 0 (random free port).
    • getHost

      public String getHost()
      The host name passed to the browser pointing to the sniffer proxy. Defaults to "localhost".
    • getUserAgent

      public String getUserAgent()
      Optionally overwrite browser user agent.
    • getMaxBufferSize

      public int getMaxBufferSize()
      Maximum byte size before a request/response content is considered too large. Can be specified using notations, e.g., 25MB. Defaults to DEFAULT_MAX_BUFFER_SIZE (10 MB).
    • getResponseTimeout

      public Duration getResponseTimeout()
      Maximum wait time for the target host to respond.
    • getNetworkInterface

      public String getNetworkInterface()
      Network interface address (IP) to be used by the sniffer proxy to listen for incoming connections. Defaults to "0.0.0.0" (all interfaces).
    • setPort

      public HttpSnifferConfig setPort(int port)
      The host port passed to the browser pointing to the sniffer proxy. Defaults to 0 (random free port).
      Returns:
      this.
    • setHost

      public HttpSnifferConfig setHost(String host)
      The host name passed to the browser pointing to the sniffer proxy. Defaults to "localhost".
      Returns:
      this.
    • setUserAgent

      public HttpSnifferConfig setUserAgent(String userAgent)
      Optionally overwrite browser user agent.
      Returns:
      this.
    • setMaxBufferSize

      public HttpSnifferConfig setMaxBufferSize(int maxBufferSize)
      Maximum byte size before a request/response content is considered too large. Can be specified using notations, e.g., 25MB. Defaults to DEFAULT_MAX_BUFFER_SIZE (10 MB).
      Returns:
      this.
    • setResponseTimeout

      public HttpSnifferConfig setResponseTimeout(Duration responseTimeout)
      Maximum wait time for the target host to respond.
      Returns:
      this.
    • setNetworkInterface

      public HttpSnifferConfig setNetworkInterface(String networkInterface)
      Network interface address (IP) to be used by the sniffer proxy to listen for incoming connections. Defaults to "0.0.0.0" (all interfaces).
      Returns:
      this.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object