BlazeServerBuilder

class BlazeServerBuilder[F[_]] extends ServerBuilder[F] with BlazeBackendBuilder[Server]

BlazeServerBuilder is the component for the builder pattern aggregating different components to finally serve requests.

BlazeServerBuilder is the component for the builder pattern aggregating different components to finally serve requests.

Variables:

Value Params
banner:

Pretty log to display on server start. An empty sequence such as Nil disables this

bufferSize:

Buffer size to use for IO operations

chunkBufferMaxSize

Size of the buffer that is used when Content-Length header is not specified.

connectorPoolSize:

Number of worker threads for the new Socket Server Group

enableWebsockets:

Enables Websocket Support

executionContext:

Execution Context the underlying blaze futures will be executed upon.

idleTimeout:

Period of Time a connection can remain idle before the connection is timed out and disconnected. Duration.Inf disables this feature.

isHttp2Enabled:

Whether or not to enable Http2 Server Features

isNio2:

Whether or not to use NIO2 or NIO1 Socket Server Group

maxConnections:

The maximum number of client connections that may be active at any time.

maxHeadersLen:

Maximum data that composes the headers. If exceeded returns a 400 Bad Request.

maxRequestLineLength:

Maximum request line to parse If exceeded returns a 400 Bad Request.

responseHeaderTimeout:

Time from when the request is made until a response line is generated before a 503 response is returned and the HttpApp is canceled

serviceErrorHandler:

The last resort to recover and generate a response this is necessary to recover totality from the error condition.

serviceMounts:

The services that are mounted on this server to serve. These services get assembled into a Router with the longer prefix winning.

socketAddress:

Socket Address the server will be mounted at

sslBits:

If defined enables secure communication to the server using the sslContext

Companion
object
trait BlazeBackendBuilder[Server]
trait ServerBuilder[F]
trait BackendBuilder[F, Server]
class Object
trait Matchable
class Any

Type members

Types

Value members

Concrete methods

override def bindSocketAddress(socketAddress: InetSocketAddress): Self
Definition Classes
ServerBuilder
def enableHttp2(enabled: Boolean): Self
def resource: Resource[F, Server]
def withBanner(banner: Seq[String]): Self
def withBufferSize(size: Int): Self
def withChannelOptions(channelOptions: ChannelOptions): BlazeServerBuilder[F]
def withChunkBufferMaxSize(chunkBufferMaxSize: Int): BlazeServerBuilder[F]
def withConnectorPoolSize(size: Int): Self
def withExecutionContext(executionContext: ExecutionContext): BlazeServerBuilder[F]
def withHttpApp(httpApp: HttpApp[F]): Self
def withIdleTimeout(idleTimeout: Duration): Self
def withLengthLimits(maxRequestLineLen: Int, maxHeadersLen: Int): Self

Configure HTTP parser length limits

Configure HTTP parser length limits

These are to avoid denial of service attacks due to, for example, an infinite request line.

Value Params
maxHeadersLen

maximum data that compose headers

maxRequestLineLen

maximum request line to parse

def withMaxConnections(maxConnections: Int): BlazeServerBuilder[F]
def withMaxHeadersLength(maxHeadersLength: Int): BlazeServerBuilder[F]
def withMaxRequestLineLength(maxRequestLineLength: Int): BlazeServerBuilder[F]
def withResponseHeaderTimeout(responseHeaderTimeout: Duration): Self
def withSelectorThreadFactory(selectorThreadFactory: ThreadFactory): Self
def withServiceErrorHandler(serviceErrorHandler: () => F): Self
def withSslContext(sslContext: SSLContext): Self

Configures the server with TLS, using the provided SSLContext and its default SSLParameters

Configures the server with TLS, using the provided SSLContext and its default SSLParameters

def withSslContextAndParameters(sslContext: SSLContext, sslParameters: SSLParameters): Self

Configures the server with TLS, using the provided SSLContext and SSLParameters.

Configures the server with TLS, using the provided SSLContext and SSLParameters.

def withWebSockets(enableWebsockets: Boolean): Self

Deprecated methods

@deprecated("Build an `SSLContext` from the first four parameters and use `withSslContext` (note lowercase). To also request client certificates, use `withSslContextAndParameters, calling either `.setWantClientAuth(true)` or `setNeedClientAuth(true)` on the `SSLParameters`.", "0.21.0-RC3")
def withSSL(keyStore: StoreInfo, keyManagerPassword: String, protocol: String, trustStore: Option[StoreInfo], clientAuth: SSLClientAuthMode): Self
Deprecated
@deprecated("Use `withSslContext` (note lowercase). To request client certificates, use `withSslContextAndParameters, calling either `.setWantClientAuth(true)` or `setNeedClientAuth(true)` on the `SSLParameters`.", "0.21.0-RC3")
def withSSLContext(sslContext: SSLContext, clientAuth: SSLClientAuthMode): Self
Deprecated

Inherited methods

def allocated: F[(Server, F[Unit])]

Returns an effect that allocates a backend and an F[Unit] to release it. The returned F waits until the backend is ready to process requests. The second element of the tuple shuts down the backend when run.

Returns an effect that allocates a backend and an F[Unit] to release it. The returned F waits until the backend is ready to process requests. The second element of the tuple shuts down the backend when run.

Unlike resource and stream, there is no automatic release of the backend. This function is intended for REPL sessions, tests, and other situations where composing a cats.effect.Resource or fs2.Stream is not tenable. resource or stream is recommended wherever possible.

Inherited from
BackendBuilder
final def bindAny(host: String): Self
Inherited from
ServerBuilder
final def bindHttp(port: Int, host: String): Self
Inherited from
ServerBuilder
final def bindLocal(port: Int): Self
Inherited from
ServerBuilder
def channelOption[A](socketOption: SocketOption[A]): Option[A]
Inherited from
BlazeBackendBuilder
final def serve: Stream[F, ExitCode]

Runs the server as a process that never emits. Useful for a server that runs for the rest of the JVM's life.

Runs the server as a process that never emits. Useful for a server that runs for the rest of the JVM's life.

Inherited from
ServerBuilder
final def serveWhile(terminateWhenTrue: Signal[F, Boolean], exitWith: Ref[F, ExitCode]): Stream[F, ExitCode]

Runs the server as a Stream that emits only when the terminated signal becomes true. Useful for servers with associated lifetime behaviors.

Runs the server as a Stream that emits only when the terminated signal becomes true. Useful for servers with associated lifetime behaviors.

Inherited from
ServerBuilder
def socketKeepAlive: Option[Boolean]
Inherited from
BlazeBackendBuilder
def socketReceiveBufferSize: Option[Int]
Inherited from
BlazeBackendBuilder
def socketReuseAddress: Option[Boolean]
Inherited from
BlazeBackendBuilder
def socketSendBufferSize: Option[Int]
Inherited from
BlazeBackendBuilder
def stream: Stream[F, Server]

Returns the backend as a single-element stream. The stream does not emit until the backend is ready to process requests. The backend is shut down when the stream is finalized.

Returns the backend as a single-element stream. The stream does not emit until the backend is ready to process requests. The backend is shut down when the stream is finalized.

Inherited from
BackendBuilder
def tcpNoDelay: Option[Boolean]
Inherited from
BlazeBackendBuilder
def withChannelOption[A](key: SocketOption[A], value: A): Self
Inherited from
BlazeBackendBuilder
def withDefaultChannelOption[A](key: SocketOption[A]): Self
Inherited from
BlazeBackendBuilder
Inherited from
BlazeBackendBuilder
Inherited from
BlazeBackendBuilder
Inherited from
BlazeBackendBuilder
Inherited from
BlazeBackendBuilder
Inherited from
BlazeBackendBuilder
def withSocketKeepAlive(socketKeepAlive: Boolean): Self
Inherited from
BlazeBackendBuilder
def withSocketReceiveBufferSize(socketReceiveBufferSize: Int): Self
Inherited from
BlazeBackendBuilder
def withSocketReuseAddress(socketReuseAddress: Boolean): Self
Inherited from
BlazeBackendBuilder
def withSocketSendBufferSize(socketSendBufferSize: Int): Self
Inherited from
BlazeBackendBuilder
def withTcpNoDelay(tcpNoDelay: Boolean): Self
Inherited from
BlazeBackendBuilder
final def withoutBanner: Self

Disable the banner when the server starts up

Disable the banner when the server starts up

Inherited from
ServerBuilder

Concrete fields

val channelOptions: ChannelOptions