Config

zio.http.Server.Config
See theConfig companion object
final case class Config(sslConfig: Option[SSLConfig], address: InetSocketAddress, acceptContinue: Boolean, keepAlive: Boolean, requestDecompression: Decompression, responseCompression: Option[ResponseCompressionConfig], requestStreaming: RequestStreaming, maxInitialLineLength: Int, maxHeaderSize: Int, logWarningOnFatalError: Boolean, gracefulShutdownTimeout: Duration, webSocketConfig: WebSocketConfig, idleTimeout: Option[Duration], avoidContextSwitching: Boolean, soBacklog: Int, tcpNoDelay: Boolean, generateHeadRoutes: Boolean = ..., requestBodyPreConnectBufferSize: Int = ...)

Attributes

Companion
object
Source
Server.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type

Members list

Value members

Concrete methods

def acceptContinue(enable: Boolean): Config

Configure the server to use HttpServerExpectContinueHandler to send a 100 HttpResponse if necessary.

Configure the server to use HttpServerExpectContinueHandler to send a 100 HttpResponse if necessary.

Attributes

Source
Server.scala

Attempts to avoid context switching between thread pools by executing requests within the server's IO thread-pool (e.g., Netty's EventLoop) until the first async/blocking boundary.

Attempts to avoid context switching between thread pools by executing requests within the server's IO thread-pool (e.g., Netty's EventLoop) until the first async/blocking boundary.

Enabling this setting can improve performance for short-lived CPU-bound tasks, but can also lead to degraded performance if the request handler performs CPU-heavy work prior to the first async boundary.

'''WARNING:''' Do not use this mode if the ZIO executor is configured to use virtual threads!

Attributes

See also

For more info on caveats of this mode, see related issue

Source
Server.scala
def binding(hostname: String, port: Int): Config

Configure the server to listen on the provided hostname and port.

Configure the server to listen on the provided hostname and port.

Attributes

Source
Server.scala
def binding(address: InetAddress, port: Int): Config

Configure the server to listen on the provided InetAddress and port.

Configure the server to listen on the provided InetAddress and port.

Attributes

Source
Server.scala
def binding(inetSocketAddress: InetSocketAddress): Config

Configure the server to listen on the provided InetSocketAddress.

Configure the server to listen on the provided InetSocketAddress.

Attributes

Source
Server.scala
def disableRequestStreaming(maxContentLength: Int): Config

Disables streaming of request bodies. Payloads larger than maxContentLength will be rejected

Disables streaming of request bodies. Payloads larger than maxContentLength will be rejected

Attributes

Source
Server.scala

Enables streaming request bodies

Enables streaming request bodies

Attributes

Source
Server.scala

Attributes

Source
Server.scala

Attributes

Source
Server.scala
def hybridRequestStreaming(maxAggregatedLength: Int): Config

Enables hybrid request streaming

Enables hybrid request streaming

Attributes

Source
Server.scala
def idleTimeout(duration: Duration): Config

Attributes

Source
Server.scala
def keepAlive(enable: Boolean): Config

Configure the server to use netty's HttpServerKeepAliveHandler to close persistent connections when enable is true (@see HttpServerKeepAliveHandler).

Configure the server to use netty's HttpServerKeepAliveHandler to close persistent connections when enable is true (@see HttpServerKeepAliveHandler).

Attributes

Source
Server.scala

Log a warning in case of fatal errors when an error response cannot be sent back to the client

Log a warning in case of fatal errors when an error response cannot be sent back to the client

Attributes

Source
Server.scala
def maxHeaderSize(headerSize: Int): Config

Configure the server to use maxHeaderSize value when encode/decode headers.

Configure the server to use maxHeaderSize value when encode/decode headers.

Attributes

Source
Server.scala
def maxInitialLineLength(initialLineLength: Int): Config

Attributes

Source
Server.scala

Attributes

Source
Server.scala

Configure the server to listen on an available open port

Configure the server to listen on an available open port

Attributes

Source
Server.scala
def port(port: Int): Config

Configure the server to listen on the provided port.

Configure the server to listen on the provided port.

Attributes

Source
Server.scala

Soft cap on the bytes the server will buffer from a streamed request body before the route handler starts consuming it. The cap may be overshot by up to one HttpContent chunk: the chunk that crosses the threshold is appended to the buffer before reads stop. Once the threshold is reached, Netty's TCP back-pressure kicks in and the client is paused until the handler calls request.body.asStream (or similar) and begins reading. Prevents heap exhaustion when an async handler defers consuming the body and the client uploads faster than the handler can connect. Applies when RequestStreaming.Enabled is configured, and also with RequestStreaming.Hybrid for request bodies that exceed the aggregated threshold and are therefore handled as streamed bodies.

Soft cap on the bytes the server will buffer from a streamed request body before the route handler starts consuming it. The cap may be overshot by up to one HttpContent chunk: the chunk that crosses the threshold is appended to the buffer before reads stop. Once the threshold is reached, Netty's TCP back-pressure kicks in and the client is paused until the handler calls request.body.asStream (or similar) and begins reading. Prevents heap exhaustion when an async handler defers consuming the body and the client uploads faster than the handler can connect. Applies when RequestStreaming.Enabled is configured, and also with RequestStreaming.Hybrid for request bodies that exceed the aggregated threshold and are therefore handled as streamed bodies.

Attributes

Source
Server.scala

Configure the server to use netty's HttpContentDecompressor to decompress Http requests (@see HttpContentDecompressor).

Configure the server to use netty's HttpContentDecompressor to decompress Http requests (@see HttpContentDecompressor).

Attributes

Source
Server.scala
def requestStreaming(requestStreaming: RequestStreaming): Config

Enables or disables request body streaming

Enables or disables request body streaming

Attributes

Source
Server.scala

Configure the new server with netty's HttpContentCompressor to compress Http responses (@see <a href = "https://netty.io/4.1/api/io/netty/handler/codec/http/HttpContentCompressor.html"HttpContentCompressor).

Configure the new server with netty's HttpContentCompressor to compress Http responses (@see <a href = "https://netty.io/4.1/api/io/netty/handler/codec/http/HttpContentCompressor.html"HttpContentCompressor).

Attributes

Source
Server.scala
def soBacklog(value: Int): Config

Sets the maximum number of connection requests that will be queued before being rejected

Sets the maximum number of connection requests that will be queued before being rejected

Attributes

Source
Server.scala
def ssl(sslConfig: SSLConfig): Config

Configure the server with the following ssl options.

Configure the server with the following ssl options.

Attributes

Source
Server.scala
def tcpNoDelay(value: Boolean): Config

Configure the server to enable/disable TCP_NODELAY. TCP_NODELAY disables Nagle's algorithm, which reduces latency for small messages.

Configure the server to enable/disable TCP_NODELAY. TCP_NODELAY disables Nagle's algorithm, which reduces latency for small messages.

Attributes

Source
Server.scala
def webSocketConfig(webSocketConfig: WebSocketConfig): Config

Attributes

Source
Server.scala

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product