Interface ServerConfiguration

    • Method Detail

      • workersCount

        int workersCount()
        Returns the count of threads in the pool used to process HTTP requests.

        Default value is Runtime.availableProcessors().

        Returns:
        a workers count
      • port

        int port()
        Returns a server port to listen on with the default server socket. If port is 0 then any available ephemeral port will be used.

        Additional named server socket configuration is accessible through the socket(String) and sockets() methods.

        Specified by:
        port in interface SocketConfiguration
        Returns:
        the server port of the default server socket
      • bindAddress

        InetAddress bindAddress()
        Returns local address where the server listens on with the default server socket. If null then listens an all local addresses.

        Additional named server socket configuration is accessible through the socket(String) and sockets() methods.

        Specified by:
        bindAddress in interface SocketConfiguration
        Returns:
        an address to bind with the default server socket; null for all local addresses
      • timeoutMillis

        int timeoutMillis()
        Returns a default server socket timeout in milliseconds or 0 for an infinite timeout.

        Additional named server socket configuration is accessible through the socket(String) and sockets() methods.

        Specified by:
        timeoutMillis in interface SocketConfiguration
        Returns:
        a default server socket timeout in milliseconds or 0
      • receiveBufferSize

        int receiveBufferSize()
        Returns proposed value of the TCP receive window that is advertised to the remote peer on the default server socket.

        If 0 then use implementation default.

        Additional named server socket configuration is accessible through the socket(String) and sockets() methods.

        Specified by:
        receiveBufferSize in interface SocketConfiguration
        Returns:
        a buffer size in bytes of the default server socket or 0
      • ssl

        SSLContext ssl()
        Returns a SSLContext to use with the default server socket. If not null then the server enforces an SSL communication.

        Additional named server socket configuration is accessible through the socket(String) and sockets() methods.

        Specified by:
        ssl in interface SocketConfiguration
        Returns:
        a SSL context to use
      • socket

        default SocketConfiguration socket​(String name)
        A socket configuration of an additional named server socket.

        An additional named server socket may have a dedicated Routing configured through WebServer.Builder.addNamedRouting(String, Routing).

        Parameters:
        name - the name of the additional server socket
        Returns:
        an additional named server socket configuration or null if there is no such named server socket
      • tracer

        Tracer tracer()
        Returns an opentracing.io tracer. Default is GlobalTracer.
        Returns:
        a tracer to use - never null (defaulting to GlobalTracer
      • context

        Context context()
        The top level Context to be used by this webserver.
        Returns:
        a context instance with registered application scoped instances
      • isHttp2Enabled

        default boolean isHttp2Enabled()
        Checks if HTTP/2 is enabled in config.
        Returns:
        Outcome of test.
      • create

        static ServerConfiguration create​(Config config)
        Creates new instance with defaults from external configuration source.
        Parameters:
        config - the externalized configuration
        Returns:
        a new instance