BlazeServerBuilder

org.http4s.blaze.server.BlazeServerBuilder
See theBlazeServerBuilder companion object
class BlazeServerBuilder[F[_]] extends ServerBuilder[F]

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

Variables:

Attributes

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

httpApp:

The services that are mounted on this server to serve..

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

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.

maxRequestLineLen:

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

maxWebSocketBufferSize:

The maximum Websocket buffer length. 'None' means unbounded.

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.

socketAddress:

Socket Address the server will be mounted at

Companion:
object
Source:
BlazeServerBuilder.scala
Graph
Supertypes
trait ServerBuilder[F]
class Object
trait Matchable
class Any

Members list

Concise view

Type members

Types

Value members

Concrete methods

override def bindSocketAddress(socketAddress: InetSocketAddress): Self

Attributes

Definition Classes
Source:
BlazeServerBuilder.scala
def enableHttp2(enabled: Boolean): Self

Attributes

Source:
BlazeServerBuilder.scala

Returns a Server resource. The resource is not acquired until the server is started and ready to accept requests.

Returns a Server resource. The resource is not acquired until the server is started and ready to accept requests.

Attributes

Source:
BlazeServerBuilder.scala
def withBanner(banner: Seq[String]): Self

Set the banner to display when the server starts up

Set the banner to display when the server starts up

Attributes

Source:
BlazeServerBuilder.scala
def withBufferSize(size: Int): Self

Attributes

Source:
BlazeServerBuilder.scala
def withChunkBufferMaxSize(chunkBufferMaxSize: Int): BlazeServerBuilder[F]

Attributes

Source:
BlazeServerBuilder.scala

Configures the compute thread pool used to process some async computations.

Configures the compute thread pool used to process some async computations.

This defaults to cats.effect.Async[F].executionContext. In almost all cases, it is desirable to use the default.

The Blaze server has a single-threaded event loop receiver used for picking up tcp connections which is completely separate to this pool. Following picking up a tcp connection, Blaze shifts to a compute pool to process requests. The request processing logic specified by the HttpApp is executed on the cats.effect.Async[F].executionContext. Some of the other async computations involved in request processing are executed on this pool.

Attributes

Source:
BlazeServerBuilder.scala
def withHttpApp(httpApp: HttpApp[F]): Self

Attributes

Source:
BlazeServerBuilder.scala
def withIdleTimeout(idleTimeout: Duration): Self

Attributes

Source:
BlazeServerBuilder.scala
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.

Attributes

maxHeadersLen

maximum data that compose headers

maxRequestLineLen

maximum request line to parse

Source:
BlazeServerBuilder.scala
def withMaxConnections(maxConnections: Int): BlazeServerBuilder[F]

Attributes

Source:
BlazeServerBuilder.scala
def withMaxHeadersLength(maxHeadersLength: Int): BlazeServerBuilder[F]

Attributes

Source:
BlazeServerBuilder.scala
def withMaxRequestLineLength(maxRequestLineLength: Int): BlazeServerBuilder[F]

Attributes

Source:
BlazeServerBuilder.scala
def withMaxWebSocketBufferSize(maxWebSocketBufferSize: Option[Int]): BlazeServerBuilder[F]

Attributes

Source:
BlazeServerBuilder.scala
def withResponseHeaderTimeout(responseHeaderTimeout: Duration): Self

Attributes

Source:
BlazeServerBuilder.scala
def withSelectorThreadFactory(selectorThreadFactory: ThreadFactory): Self

Attributes

Source:
BlazeServerBuilder.scala
def withServiceErrorHandler(serviceErrorHandler: () => F): Self

Sets the handler for errors thrown invoking the service. Is not guaranteed to be invoked on errors on the server backend, such as parsing a request or handling a context timeout.

Sets the handler for errors thrown invoking the service. Is not guaranteed to be invoked on errors on the server backend, such as parsing a request or handling a context timeout.

Attributes

Source:
BlazeServerBuilder.scala
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

Attributes

Source:
BlazeServerBuilder.scala
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.

Attributes

Source:
BlazeServerBuilder.scala

Deprecated methods

def withSSL(keyStore: StoreInfo, keyManagerPassword: String, protocol: String, trustStore: Option[StoreInfo], clientAuth: SSLClientAuthMode): Self

Attributes

Deprecated
true
Source:
BlazeServerBuilder.scala
def withSSLContext(sslContext: SSLContext, clientAuth: SSLClientAuthMode): Self

Attributes

Deprecated
true
Source:
BlazeServerBuilder.scala
def withWebSockets(enableWebsockets: Boolean): Self

Attributes

Deprecated
true
Source:
BlazeServerBuilder.scala

Inherited methods

final def bindAny(host: String): Self

Attributes

Inherited from:
ServerBuilder
Source:
ServerBuilder.scala
final def bindHttp(port: Int, host: String): Self

Attributes

Inherited from:
ServerBuilder
Source:
ServerBuilder.scala
final def bindLocal(port: Int): Self

Attributes

Inherited from:
ServerBuilder
Source:
ServerBuilder.scala
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.

Attributes

Inherited from:
ServerBuilder
Source:
ServerBuilder.scala

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.

Attributes

Inherited from:
ServerBuilder
Source:
ServerBuilder.scala
def stream: Stream[F, A]

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.

Attributes

Inherited from:
BackendBuilder (hidden)
Source:
BackendBuilder.scala
final def withoutBanner: Self

Disable the banner when the server starts up

Disable the banner when the server starts up

Attributes

Inherited from:
ServerBuilder
Source:
ServerBuilder.scala

Deprecated and Inherited methods

def allocated: F[(A, 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.

Attributes

Deprecated
true
Inherited from:
BackendBuilder (hidden)
Source:
BackendBuilder.scala

Concrete fields