Class ServerConfiguration

java.lang.Object
org.attribyte.snook.ServerConfiguration

public class ServerConfiguration extends Object
HTTP server configuration.
  • Field Details

    • LISTEN_IP_PROPERTY

      public static final String LISTEN_IP_PROPERTY
      The listen IP property name ("listenIP").
      See Also:
    • DEFAULT_LISTEN_IP

      public static final String DEFAULT_LISTEN_IP
      The default value for the listen IP "127.0.0.1".
      See Also:
    • LISTEN_PORT_PROPERTY

      public static final String LISTEN_PORT_PROPERTY
      The listen port property name ("httpPort").
      See Also:
    • DEFAULT_LISTEN_PORT

      public static final int DEFAULT_LISTEN_PORT
      The default listen port 8081.
      See Also:
    • SECURE_LISTEN_PORT_PROPERTY

      public static final String SECURE_LISTEN_PORT_PROPERTY
      The listen port for secure connections property name ("httpsPort").
      See Also:
    • DEFAULT_SECURE_LISTEN_PORT

      public static final int DEFAULT_SECURE_LISTEN_PORT
      The default listen port for secure connections 8443.
      See Also:
    • OUTPUT_BUFFER_SIZE_PROPERTY

      public static final String OUTPUT_BUFFER_SIZE_PROPERTY
      The listen output buffer size property name ("outputBufferSize").
      See Also:
    • DEFAULT_OUTPUT_BUFFER_SIZE

      public static final int DEFAULT_OUTPUT_BUFFER_SIZE
      The default value for the output buffer size (32768).
      See Also:
    • MAX_REQUEST_HEADER_PROPERTY

      public static final String MAX_REQUEST_HEADER_PROPERTY
      The maximum request header size property name ("maxRequestHeaderSize").
      See Also:
    • DEFAULT_MAX_REQUEST_HEADER_SIZE

      public static final int DEFAULT_MAX_REQUEST_HEADER_SIZE
      The default value for the maximum request header size (8192).
      See Also:
    • MAX_RESPONSE_HEADER_PROPERTY

      public static final String MAX_RESPONSE_HEADER_PROPERTY
      The maximum response header size property name ("maxResponseHeaderSize").
      See Also:
    • DEFAULT_MAX_RESPONSE_HEADER_SIZE

      public static final int DEFAULT_MAX_RESPONSE_HEADER_SIZE
      The default value for the maximum response header size (8192).
      See Also:
    • SEND_SERVER_VERSION_PROPERTY

      public static final String SEND_SERVER_VERSION_PROPERTY
      The send server version property name ("sendServerVersion").
      See Also:
    • DEFAULT_SEND_SERVER_VERSION

      public static final boolean DEFAULT_SEND_SERVER_VERSION
      The default value for sending the server version (false).
      See Also:
    • SEND_DATE_HEADER_PROPERTY

      public static final String SEND_DATE_HEADER_PROPERTY
      The send date header property name ("sendDateHeader").
      See Also:
    • DEFAULT_SEND_DATE_HEADER

      public static final boolean DEFAULT_SEND_DATE_HEADER
      The default value for sending the date header (false).
      See Also:
    • MAX_FORM_CONTENT_SIZE_PROPERTY

      public static final String MAX_FORM_CONTENT_SIZE_PROPERTY
      The maximum form content size property name ("maxFormContentSize").
      See Also:
    • DEFAULT_MAX_FORM_CONTENT_SIZE

      public static final int DEFAULT_MAX_FORM_CONTENT_SIZE
      The default value for the maximum form content size (10000000).
      See Also:
    • IDLE_TIMEOUT_PROPERTY

      public static final String IDLE_TIMEOUT_PROPERTY
      The idle timeout property name ("idleTimeout").
      See Also:
    • DEFAULT_IDLE_TIMEOUT

      public static final String DEFAULT_IDLE_TIMEOUT
      The default value for idle timeout ("30s").
      See Also:
    • DEBUG_PROPERTY

      public static final String DEBUG_PROPERTY
      The "debug" mode property name ("debug").
      See Also:
    • CONNECTION_SECURITY_PROPERTY

      public static final String CONNECTION_SECURITY_PROPERTY
      The connection security property name ("connectionSecurity").
      See Also:
    • DEFAULT_CONNECTION_SECURITY

      public static final String DEFAULT_CONNECTION_SECURITY
      The default value for connection security ("none").
      See Also:
    • DEFAULT_DEBUG_MODE

      public static final boolean DEFAULT_DEBUG_MODE
      The default "debug" mode (false).
      See Also:
    • KEYSTORE_FILE_PROPERTY

      public static final String KEYSTORE_FILE_PROPERTY
      The property name for the path to the keystore ("keystore.File").
      See Also:
    • KEYSTORE_PASSWORD_PROPERTY

      public static final String KEYSTORE_PASSWORD_PROPERTY
      The property name for the keystore password ("keystorePassword").
      See Also:
    • KEYSTORE_PROVIDER_PROPERTY

      public static final String KEYSTORE_PROVIDER_PROPERTY
      The property name for the keystore provider, e.g. PKCS12 ("keystoreProvider").
      See Also:
    • KEYSTORE_CHECK_PROPERTY

      public static final String KEYSTORE_CHECK_PROPERTY
      The property name for the keystore check interval ("keystoreCheckInterval").
      See Also:
    • TRUSTSTORE_FILE_PROPERTY

      public static final String TRUSTSTORE_FILE_PROPERTY
      The property name for the path to the truststore ("truststore.File").
      See Also:
    • TRUSTSTORE_RESOURCE_PROPERTY

      public static final String TRUSTSTORE_RESOURCE_PROPERTY
      The property name for a truststore resource URL ("truststoreResource").
      See Also:
    • TRUSTSTORE_PASSWORD_PROPERTY

      public static final String TRUSTSTORE_PASSWORD_PROPERTY
      The property name for the truststore password ("truststorePassword").
      See Also:
    • ENABLE_FORWARDED_REQUEST_CUSTOMIZER_PROPERTY

      public static final String ENABLE_FORWARDED_REQUEST_CUSTOMIZER_PROPERTY
      The property name for the enable forwarded request cusomizer flag ("enableForwardedRequestCustomizer".
      See Also:
    • SUPPRESS_STACK_TRACE_PROPERTY

      public static final String SUPPRESS_STACK_TRACE_PROPERTY
      The property name to suppress stack trace output for unhandled exceptions.
      See Also:
    • listenIP

      public final String listenIP
      The IP this server is listening on.
    • httpPort

      public final int httpPort
      The port this server is listening on.
    • httpsPort

      public final int httpsPort
      The port this server is listening on for secure connections.
    • outputBufferSize

      public final int outputBufferSize
      The size of the buffer into which httpResponse content is aggregated before being sent to the client.
    • requestHeaderSize

      public final int requestHeaderSize
      The maximum size of a request header.
    • responseHeaderSize

      public final int responseHeaderSize
      The maximum size of a request header.
    • sendServerVersion

      public final boolean sendServerVersion
      Should the server version be sent with responses?
    • sendDateHeader

      public final boolean sendDateHeader
      Should a Date header be sent with responses?
    • idleTimeout

      public final long idleTimeout
      The maximum idle time in milliseconds.
    • maxFormContentSize

      public final int maxFormContentSize
      The maximum size allowed for posted forms.
    • debug

      public final boolean debug
      Is "debug" mode configured?
    • connectionSecurity

      public final ServerConfiguration.ConnectionSecurity connectionSecurity
      The configured connection security.
    • keyStorePath

      public final String keyStorePath
      The path to the key store.
    • keyStoreProvider

      public final String keyStoreProvider
      The key store provider.
    • keyStorePasswordWasSpecified

      public final boolean keyStorePasswordWasSpecified
      Identifies if a password was specified for the key store.
    • keyStoreCheckInterval

      public final String keyStoreCheckInterval
      The time between checks for a key store change.
    • keyStoreCheckIntervalMillis

      public final long keyStoreCheckIntervalMillis
      The keystore check interval in milliseconds.
    • trustStorePath

      public final String trustStorePath
      The path to the trust store.
    • trustStoreResource

      public final String trustStoreResource
      The URL for a trust store resource.
    • trustStorePasswordWasSpecified

      public final boolean trustStorePasswordWasSpecified
      Identifies if a password was specified for the trust store.
    • enableForwardedRequestCustomizer

      public final boolean enableForwardedRequestCustomizer
      Is the forwarded request customizer enabled? Default true.

      Alters the request by using headers like X-Forwarded-For to make the real endpoint visible.

    • suppressStackTrace

      public final boolean suppressStackTrace
      Are stack traces for unhandled exceptions suppressed? Default false.
  • Constructor Details

    • ServerConfiguration

      public ServerConfiguration() throws org.attribyte.api.InitializationException
      Creates a server configuration with default values.
      Throws:
      org.attribyte.api.InitializationException - on invalid configuration.
    • ServerConfiguration

      public ServerConfiguration(String namePrefix, Properties props) throws org.attribyte.api.InitializationException
      Creates a server configuration from properties.
      Parameters:
      namePrefix - A prefix to be applied to names in the properties server. for example.
      props - The properties.
      Throws:
      org.attribyte.api.InitializationException - on invalid configuration.
  • Method Details

    • propertyDocumentation

      public static String propertyDocumentation()
      Returns formatted documentation of all server configuration properties.
      Returns:
      The property documentation string.
    • toString

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

      public org.eclipse.jetty.server.Server buildServer()
      Builds a server instance form this configuration.
      Returns:
      The server.