Package-level declarations

Types

Link copied to clipboard

An engine which runs an application.

Link copied to clipboard

Represents an environment in which engine runs.

Link copied to clipboard

Engine environment configuration builder

Engine environment configuration builder

Engine environment configuration builder

Link copied to clipboard
class ApplicationEngineEnvironmentReloading(val classLoader: ClassLoader, val log: Logger, val config: ApplicationConfig, val connectors: List<EngineConnectorConfig>, modules: List<Application.() -> Unit>, watchPaths: List<String> = emptyList(), parentCoroutineContext: CoroutineContext = EmptyCoroutineContext, val rootPath: String = "", val developmentMode: Boolean = true) : ApplicationEngineEnvironment

Implements ApplicationEngineEnvironment by loading an Application from a folder or jar.

Link copied to clipboard
Link copied to clipboard
abstract class BaseApplicationCall(val application: Application) : ApplicationCall

Base class for implementing an ApplicationCall.

Link copied to clipboard
abstract class BaseApplicationEngine(val environment: ApplicationEngineEnvironment, val pipeline: EnginePipeline = defaultEnginePipeline(environment)) : ApplicationEngine

Base class for implementing ApplicationEngine

Link copied to clipboard

Base class for implementing ApplicationRequest

Link copied to clipboard
Link copied to clipboard
data class ConnectorType(val name: String)

Represents a type of a connector, e.g HTTP or HTTPS.

Link copied to clipboard
class DefaultUncaughtExceptionHandler(logger: () -> Logger) : CoroutineExceptionHandler

Handles all uncaught exceptions and logs errors with the specified logger ignoring CancellationException and IOException.

Link copied to clipboard
open class EngineConnectorBuilder(val type: ConnectorType = ConnectorType.HTTP) : EngineConnectorConfig

Mutable implementation of EngineConnectorConfig for building connectors programmatically

Link copied to clipboard

Represents a connector configuration.

Link copied to clipboard
class EnginePipeline(val developmentMode: Boolean = false) : Pipeline<Unit, ApplicationCall>

Application engine pipeline. One usually don't need to install interceptors here unless your are writing your own engine implementation

Link copied to clipboard
class EngineSSLConnectorBuilder(var keyStore: KeyStore, var keyAlias: String, var keyStorePassword: () -> CharArray, var privateKeyPassword: () -> CharArray) : EngineConnectorBuilder, EngineSSLConnectorConfig

Mutable implementation of EngineSSLConnectorConfig for building connectors programmatically

Link copied to clipboard

Represents an SSL connector configuration.

Link copied to clipboard
class NativeApplicationEngineEnvironment(val log: Logger, val config: ApplicationConfig, val connectors: MutableList<EngineConnectorConfig>, modules: MutableList<Application.() -> Unit>, val parentCoroutineContext: CoroutineContext, val rootPath: String, val developmentMode: Boolean) : ApplicationEngineEnvironment
Link copied to clipboard
class ShutDownUrl(val url: String, val exitCode: ApplicationCall.() -> Int)

A plugin that allows you to configure a URL used to shut down the server. There are two ways to enable this plugin:

Functions

Link copied to clipboard
expect fun ApplicationEngine.addShutdownHook(stop: () -> Unit)

Adds automatic application shutdown hooks management. Should be used before starting the engine. Once application termination noticed, stop block will be executed. Please note that a shutdown hook only registered when the application is running. If the application is already stopped then there will be no hook and no stop function invocation possible. So stop block will be called once or never.

actual fun ApplicationEngine.addShutdownHook(stop: () -> Unit)

Adds automatic JVM shutdown hooks management. Should be used before starting the engine. Once JVM termination noticed, stop block will be executed. Please note that a shutdown hook only registered when the application is running. If the application is already stopped then there will be no hook and no stop function invocation possible. So stop block will be called once or never.

actual fun ApplicationEngine.addShutdownHook(stop: () -> Unit)

Adds automatic application shutdown hooks management. Should be used before starting the engine. Once application termination noticed, stop block will be executed. Please note that a shutdown hook only registered when the application is running. If the application is already stopped then there will be no hook and no stop function invocation possible. So stop block will be called once or never.

Link copied to clipboard

Creates an ApplicationEngineEnvironment instance from command line arguments

Creates an ApplicationEngineEnvironment instance from command line arguments

Link copied to clipboard

Adds a non-secure connector to this engine environment

Link copied to clipboard

Default engine pipeline for all engines. Use it only if you are writing your own application engine implementation.

Link copied to clipboard

Map cause to the corresponding status code or null if no default exception mapping for this cause type

Link copied to clipboard

Creates an embedded server with the given factory, environment and configure script

fun <TEngine : ApplicationEngine, TConfiguration : ApplicationEngine.Configuration> embeddedServer(factory: ApplicationEngineFactory<TEngine, TConfiguration>, port: Int = 80, host: String = "0.0.0.0", watchPaths: List<String> = listOf(WORKING_DIRECTORY_PATH), configure: TConfiguration.() -> Unit = {}, module: Application.() -> Unit): TEngine
fun <TEngine : ApplicationEngine, TConfiguration : ApplicationEngine.Configuration> CoroutineScope.embeddedServer(factory: ApplicationEngineFactory<TEngine, TConfiguration>, port: Int = 80, host: String = "0.0.0.0", watchPaths: List<String> = listOf(WORKING_DIRECTORY_PATH), parentCoroutineContext: CoroutineContext = EmptyCoroutineContext, configure: TConfiguration.() -> Unit = {}, module: Application.() -> Unit): TEngine

Creates an embedded server with the given factory, listening on host:port

fun <TEngine : ApplicationEngine, TConfiguration : ApplicationEngine.Configuration> CoroutineScope.embeddedServer(factory: ApplicationEngineFactory<TEngine, TConfiguration>, vararg connectors: EngineConnectorConfig = arrayOf(EngineConnectorBuilder()), watchPaths: List<String> = listOf(WORKING_DIRECTORY_PATH), parentCoroutineContext: CoroutineContext = EmptyCoroutineContext, configure: TConfiguration.() -> Unit = {}, module: Application.() -> Unit): TEngine

Creates an embedded server with the given factory, listening on given connectors

Link copied to clipboard
suspend fun handleFailure(call: ApplicationCall, error: Throwable)
Link copied to clipboard
Link copied to clipboard
fun Job.launchOnCancellation(block: suspend () -> Unit): CompletableJob

Launch a coroutine with block body when the parent job is cancelled or a returned deferred is cancelled. It is important to complete or cancel returned deferred otherwise the parent job will be unable to complete successfully.

Link copied to clipboard

Load engine's configuration suitable for all engines from deploymentConfig

Link copied to clipboard
suspend fun logError(call: ApplicationCall, error: Throwable)
Link copied to clipboard
inline fun ApplicationEngineEnvironmentBuilder.sslConnector(keyStore: KeyStore, keyAlias: String, noinline keyStorePassword: () -> CharArray, noinline privateKeyPassword: () -> CharArray, builder: EngineSSLConnectorBuilder.() -> Unit)

Adds a secure connector to this engine environment

Link copied to clipboard
fun ApplicationEngine.stop(gracePeriod: Long, timeout: Long, timeUnit: TimeUnit)
Link copied to clipboard

Stop server on job cancellation. The returned deferred need to be completed or cancelled.

Link copied to clipboard

Returns new instance of EngineConnectorConfig based on this with modified port

Returns new instance of EngineConnectorConfig based on this with modified port

Returns new instance of EngineConnectorConfig based on this with modified port