HttpServer

data class HttpServer(    adapter: HttpServerPort,     val handlers: List<ServerHandler>,     val settings: HttpServerSettings = HttpServerSettings()) : Closeable

Server that listen to HTTP connections on a port and address and route requests to handlers.

Constructors

Link copied to clipboard
fun HttpServer(    adapter: HttpServerPort,     settings: HttpServerSettings = HttpServerSettings(),     block: ServerBuilder.() -> Unit)

Create a server with a builder (ServerBuilder) to set up handlers.

Link copied to clipboard
fun HttpServer(    adapter: HttpServerPort,     handler: ServerHandler,     settings: HttpServerSettings = HttpServerSettings())

Utility constructor for the common case of having a single root handler.

Link copied to clipboard
fun HttpServer(    adapter: HttpServerPort,     handlers: List<ServerHandler>,     settings: HttpServerSettings = HttpServerSettings())

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
fun start()

Start the server with the adapter instance and adds a shutdown hook for stopping the server.

Link copied to clipboard
fun started(): Boolean

Check whether the server has been started.

Link copied to clipboard
fun stop()

Stop the server.

Properties

Link copied to clipboard
val handlers: List<ServerHandler>
Link copied to clipboard
val portName: String

The port name of the server.

Link copied to clipboard
val runtimePort: Int

Runtime port of the server.

Link copied to clipboard
val settings: HttpServerSettings