HttpServer

class HttpServer(adapter: HttpServerPort, val handler: HttpHandler, val settings: HttpServerSettings = HttpServerSettings()) : Closeable

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

TODO Allow light startup log

Constructors

Link copied to clipboard
constructor(adapter: HttpServerPort, settings: HttpServerSettings = HttpServerSettings(), block: HandlerBuilder.() -> Unit)

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

constructor(adapter: HttpServerPort, handler: HttpHandler, settings: HttpServerSettings = HttpServerSettings())

Properties

Link copied to clipboard

Runtime binding of the server.

Link copied to clipboard
Link copied to clipboard

The port name of the server.

Link copied to clipboard

Runtime port of the server.

Link copied to clipboard

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
fun createBanner(startUpTimestamp: Long = -1, banner: String = serverBanner, detailed: Boolean = false): String
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

Check whether the server has been started.

Link copied to clipboard
fun stop()

Stop the server.