Class ServerConfig

java.lang.Object
com.linecorp.armeria.server.ServerConfig

public final class ServerConfig extends Object
Server configuration.
  • Method Details

    • server

      public Server server()
      Returns the Server.
    • ports

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

      public 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()
    • virtualHosts

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

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

      public 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:
      ServerBuilder.virtualHost(int)
    • findVirtualHosts

      public 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

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

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

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

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

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

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

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

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

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

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

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

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

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

      public 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

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

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

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

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

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

      public 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

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

      public 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

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

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

      public 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

      public 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

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

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

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

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

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

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

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

      public 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.
    • toString

      public String toString()
      Overrides:
      toString in class Object