Interface ServerConfig


public interface ServerConfig
Server configuration.
  • Method Details

    • server

      Server server()
      Returns the Server.
    • ports

      List<ServerPort> ports()
      Returns the ServerPorts to listen on.
      See Also:
    • defaultVirtualHost

      VirtualHost defaultVirtualHost()
      Returns the default VirtualHost, which is used when no other VirtualHosts match the host name of a client request. e.g. the "Host" header in HTTP or host name in TLS SNI extension
      See Also:
    • virtualHosts

      List<VirtualHost> virtualHosts()
      Returns the List of available VirtualHosts.
      Returns:
      the List of available VirtualHosts where its last VirtualHost is defaultVirtualHost()
    • findVirtualHost

      @Deprecated VirtualHost findVirtualHost(String hostname)
      Deprecated.
      Finds the VirtualHost that matches the specified hostname. If there's no match, the defaultVirtualHost() is returned.
    • findVirtualHost

      VirtualHost findVirtualHost(String hostname, int port)
      Finds the VirtualHost that matches the specified hostname and port. The port is used to find a port-based virtual host that was bound to the port. If there's no match, the defaultVirtualHost() is returned.
      See Also:
    • findVirtualHosts

      List<VirtualHost> findVirtualHosts(HttpService service)
      Finds the List of VirtualHosts that contains the specified HttpService. If there's no match, an empty List is returned. Note that this is potentially an expensive operation and thus should not be used in a performance-sensitive path.
    • serviceConfigs

      List<ServiceConfig> serviceConfigs()
      Returns the information of all available HttpServices in the Server.
    • workerGroup

      EventLoopGroup workerGroup()
      Returns the worker EventLoopGroup which is responsible for performing socket I/O and running Service.serve(ServiceRequestContext, Request).
    • shutdownWorkerGroupOnStop

      boolean shutdownWorkerGroupOnStop()
      Returns whether the worker EventLoopGroup is shut down when the Server stops.
    • channelOptions

      Map<ChannelOption<?>,?> channelOptions()
      Returns the ChannelOptions and their values of Server's server sockets.
    • childChannelOptions

      Map<ChannelOption<?>,?> childChannelOptions()
      Returns the ChannelOptions and their values of sockets accepted by Server.
    • maxNumConnections

      int maxNumConnections()
      Returns the maximum allowed number of open connections.
    • idleTimeoutMillis

      long idleTimeoutMillis()
      Returns the idle timeout of a connection in milliseconds for keep-alive.
    • pingIntervalMillis

      long pingIntervalMillis()
      Returns the HTTP/2 PING interval in milliseconds.
    • maxConnectionAgeMillis

      long maxConnectionAgeMillis()
      Returns the maximum allowed age of a connection in milliseconds for keep-alive.
    • connectionDrainDurationMicros

      long connectionDrainDurationMicros()
      Returns the graceful connection shutdown drain duration.
    • maxNumRequestsPerConnection

      int maxNumRequestsPerConnection()
      Returns the maximum allowed number of requests that can be served through one connection.
    • http1MaxInitialLineLength

      int http1MaxInitialLineLength()
      Returns the maximum length of an HTTP/1 response initial line.
    • http1MaxHeaderSize

      int http1MaxHeaderSize()
      Returns the maximum length of all headers in an HTTP/1 response.
    • http1MaxChunkSize

      int http1MaxChunkSize()
      Returns the maximum length of each chunk in an HTTP/1 response content. The content or a chunk longer than this value will be split into smaller chunks so that their lengths never exceed it.
    • http2InitialConnectionWindowSize

      int http2InitialConnectionWindowSize()
      Returns the initial connection-level HTTP/2 flow control window size.
    • http2InitialStreamWindowSize

      int http2InitialStreamWindowSize()
      Returns the initial stream-level HTTP/2 flow control window size.
    • http2MaxStreamsPerConnection

      long http2MaxStreamsPerConnection()
      Returns the maximum number of concurrent streams per HTTP/2 connection.
    • http2MaxFrameSize

      int http2MaxFrameSize()
      Returns the maximum size of HTTP/2 frames that can be received.
    • http2MaxHeaderListSize

      long http2MaxHeaderListSize()
      Returns the maximum size of headers that can be received.
    • gracefulShutdownQuietPeriod

      Duration gracefulShutdownQuietPeriod()
      Returns the number of milliseconds to wait for active requests to go end before shutting down. 0 means the server will stop right away without waiting.
    • gracefulShutdownTimeout

      Duration gracefulShutdownTimeout()
      Returns the number of milliseconds to wait before shutting down the server regardless of active requests.
    • blockingTaskExecutor

      ScheduledExecutorService blockingTaskExecutor()
      Returns the ScheduledExecutorService dedicated to the execution of blocking tasks or invocations. Note that the ScheduledExecutorService returned by this method does not set the ServiceRequestContext when executing a submitted task. Use ServiceRequestContext.blockingTaskExecutor() if possible.
    • shutdownBlockingTaskExecutorOnStop

      boolean shutdownBlockingTaskExecutorOnStop()
      Returns whether the worker Executor is shut down when the Server stops.
    • meterRegistry

      MeterRegistry meterRegistry()
      Returns the MeterRegistry that collects various stats.
    • proxyProtocolMaxTlvSize

      int proxyProtocolMaxTlvSize()
      Returns the maximum size of additional data (TLV, Tag-Length-Value). It is only used when PROXY protocol is enabled on the server port.
    • clientAddressSources

      List<ClientAddressSource> clientAddressSources()
      Returns a list of ClientAddressSources which are used to determine where to look for the client address, in the order of preference.
    • clientAddressTrustedProxyFilter

      Predicate<? super InetAddress> clientAddressTrustedProxyFilter()
      Returns a filter which evaluates whether an InetAddress of a remote endpoint is trusted.
    • clientAddressFilter

      Predicate<? super InetAddress> clientAddressFilter()
      Returns a filter which evaluates whether an InetAddress can be used as a client address.
    • clientAddressMapper

      Function<? super ProxiedAddresses,? extends InetSocketAddress> clientAddressMapper()
      Returns a Function to use when determining the client address from ProxiedAddresses.
    • isDateHeaderEnabled

      boolean isDateHeaderEnabled()
      Returns whether the response header will include default "Date" header.
    • isServerHeaderEnabled

      boolean isServerHeaderEnabled()
      Returns whether the response header will include default "Server" header.
    • requestIdGenerator

      Supplier<RequestId> requestIdGenerator()
      Returns the Supplier that generates a RequestId for each Request.
    • errorHandler

      ServerErrorHandler errorHandler()
      Returns the ServerErrorHandler that provides the error responses in case of unexpected exceptions or protocol errors.
    • http1HeaderNaming

      Http1HeaderNaming http1HeaderNaming()
      Returns the Http1HeaderNaming which converts a lower-cased HTTP/2 header name into another HTTP/1 header name. This is useful when communicating with a legacy system that only supports case sensitive HTTP/1 headers.