Class HttpConnector

java.lang.Object
org.shredzone.acme4j.connector.HttpConnector

public class HttpConnector
extends java.lang.Object
A generic HTTP connector. It connects to the given URL with a 10 seconds connection and read timeout.

Subclasses may reconfigure the HttpURLConnection and pin it to a concrete SSL certificate.

  • Constructor Summary

    Constructors
    Constructor Description
    HttpConnector()  
  • Method Summary

    Modifier and Type Method Description
    protected void configure​(java.net.HttpURLConnection conn, NetworkSettings settings)
    Configures the new HttpURLConnection.
    static java.lang.String defaultUserAgent()
    Returns the default User-Agent to be used.
    java.net.HttpURLConnection openConnection​(java.net.URL url, NetworkSettings settings)
    Opens a HttpURLConnection to the given URL.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • defaultUserAgent

      public static java.lang.String defaultUserAgent()
      Returns the default User-Agent to be used.
      Returns:
      User-Agent
    • openConnection

      public java.net.HttpURLConnection openConnection​(java.net.URL url, NetworkSettings settings) throws java.io.IOException
      Opens a HttpURLConnection to the given URL.
      Parameters:
      url - URL to connect to
      settings - NetworkSettings to be used
      Returns:
      HttpURLConnection connected to the URL
      Throws:
      java.io.IOException
    • configure

      protected void configure​(java.net.HttpURLConnection conn, NetworkSettings settings)
      Configures the new HttpURLConnection.

      The HttpURLConnection is already preconfigured with a reasonable timeout, disabled caches and a User-Agent header. Subclasses can override this method to change the configuration.

      Parameters:
      conn - HttpURLConnection to configure.
      settings - NetworkSettings with settings to be used