Class ClientOptions

java.lang.Object
org.attribyte.api.http.ClientOptions

public class ClientOptions extends Object
Configuration options for clients.
  • Field Details

    • IMPLEMENTATION_DEFAULT

      public static final ClientOptions IMPLEMENTATION_DEFAULT
      Indicates that implementation defaults should be used.
    • userAgent

      public final String userAgent
      The user agent ('AttribyteHttp/1.0').
    • connectionTimeoutMillis

      public final int connectionTimeoutMillis
      The maximum amount of time to wait to establish a connection (5s).
    • requestTimeoutMillis

      public final int requestTimeoutMillis
      The maximum amount of time to wait for a response after sending a request (5s).
    • socketTimeoutMillis

      public final int socketTimeoutMillis
      The maximum amount of time to wait for a (blocking) socket read to return (5s).
    • proxyHost

      public final String proxyHost
      A proxy server.
    • proxyPort

      public final int proxyPort
      The proxy server port.
    • followRedirects

      public final boolean followRedirects
      Should redirects be followed (true).
    • maxConnectionsPerDestination

      public final int maxConnectionsPerDestination
      The maximum number of connections per destination (1024).
    • maxConnectionsTotal

      public final int maxConnectionsTotal
      The maximum number of connections for all destinations (4096).
    • requestBufferSize

      public final int requestBufferSize
      The request buffer size (4096).
    • responseBufferSize

      public final int responseBufferSize
      The response buffer size (16384).
    • trustAllCertificates

      public final boolean trustAllCertificates
      Should SSL certificates be trusted even if invalid (false).
    • cookieStore

      public final CookieStore cookieStore
      The cookie store, if any.
  • Constructor Details

    • ClientOptions

      public ClientOptions(String prefix, Properties props) throws org.attribyte.api.InitializationException
      Creates options from properties.
      Parameters:
      prefix - A prefix applied to all property names.
      props - The properties.
      Throws:
      org.attribyte.api.InitializationException - on invalid property.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getProperty

      public String getProperty(String name, String defaultValue)
      Gets a property.
      Parameters:
      name - The property name.
      defaultValue - The default value.
      Returns:
      The property or default value.
    • getIntProperty

      public int getIntProperty(String name, int defaultValue)
      Gets an integer property.
      Parameters:
      name - The property name.
      defaultValue - The default value.
      Returns:
      The property or default value.
    • getBooleanProperty

      public boolean getBooleanProperty(String name, boolean defaultValue)
      Gets a boolean property.
      Parameters:
      name - The property name.
      defaultValue - The default value.
      Returns:
      The property or default value.
    • getTimeProperty

      public int getTimeProperty(String name, int defaultValue)
      Gets a time (string) property as milliseconds.
      Parameters:
      name - The property name.
      defaultValue - The default value.
      Returns:
      The property or default value.