Package io.ktor.server.engine

Types

ApplicationEngine

interface ApplicationEngine

Engine which runs an application

ApplicationEngineEnvironment

interface ApplicationEngineEnvironment : 
    ApplicationEnvironment

Represents an environment in which engine runs

ApplicationEngineEnvironmentBuilder

class ApplicationEngineEnvironmentBuilder

Engine environment configuration builder

ApplicationEngineEnvironmentReloading

class ApplicationEngineEnvironmentReloading : 
    ApplicationEngineEnvironment

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

ApplicationEngineFactory

interface ApplicationEngineFactory<out TEngine : ApplicationEngine, TConfiguration : Configuration>

Factory interface for creating ApplicationEngine instances

BaseApplicationCall

abstract class BaseApplicationCall : ApplicationCall

Base class for implementing an ApplicationCall.

BaseApplicationEngine

abstract class BaseApplicationEngine : ApplicationEngine

Base class for implementing ApplicationEngine

BaseApplicationRequest

abstract class BaseApplicationRequest : ApplicationRequest

Base class for implementing ApplicationRequest

BaseApplicationResponse

abstract class BaseApplicationResponse : ApplicationResponse

Base class for implementing an ApplicationResponse

ConnectorType

data class ConnectorType

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

EngineConnectorBuilder

open class EngineConnectorBuilder : EngineConnectorConfig

Mutable implementation of EngineConnectorConfig for building connectors programmatically

EngineConnectorConfig

interface EngineConnectorConfig

Represents a connector configuration.

EnginePipeline

class EnginePipeline : Pipeline<Unit, ApplicationCall>

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

EngineSSLConnectorBuilder

class EngineSSLConnectorBuilder : 
    EngineConnectorBuilder,
    EngineSSLConnectorConfig

Mutable implementation of EngineSSLConnectorConfig for building connectors programmatically

EngineSSLConnectorConfig

interface EngineSSLConnectorConfig : EngineConnectorConfig

Represents an SSL connector configuration.

ShutDownUrl

class ShutDownUrl

Shutdown URL feature. It stops application when requested particular url

Annotations

EngineAPI

annotation class EngineAPI

API marked with this annotation is not intended to be used by end users unless a custom server engine implementation is required

Extensions for External Classes

kotlinx.coroutines.CoroutineScope

kotlinx.coroutines.Job

Functions

applicationEngineEnvironment

fun applicationEngineEnvironment(
    builder: ApplicationEngineEnvironmentBuilder.() -> Unit
): ApplicationEngineEnvironment

Creates ApplicationEngineEnvironment using ApplicationEngineEnvironmentBuilder

commandLineEnvironment

fun commandLineEnvironment(
    args: Array<String>
): ApplicationEngineEnvironment

Creates an ApplicationEngineEnvironment instance from command line arguments

connector

fun ApplicationEngineEnvironmentBuilder.connector(
    builder: EngineConnectorBuilder.() -> Unit
): Unit

Adds a non-secure connector to this engine environment

defaultEnginePipeline

fun defaultEnginePipeline(
    environment: ApplicationEnvironment
): EnginePipeline

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

defaultExceptionStatusCode

fun defaultExceptionStatusCode(
    cause: Throwable
): HttpStatusCode?

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

embeddedServer

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

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

fun <TEngine : ApplicationEngine, TConfiguration : Configuration> embeddedServer(
    factory: ApplicationEngineFactory<TEngine, TConfiguration>,
    environment: ApplicationEngineEnvironment,
    configure: TConfiguration.() -> Unit = {}
): TEngine

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

installDefaultTransformations

fun ApplicationSendPipeline.installDefaultTransformations(): Unit

Default send transformation

fun ApplicationReceivePipeline.installDefaultTransformations(): Unit

Default receive transformation

loadCommonConfiguration

fun Configuration.loadCommonConfiguration(
    deploymentConfig: ApplicationConfig
): Unit

Load engine’s configuration suitable for all engines from deploymentConfig

sslConnector

fun ApplicationEngineEnvironmentBuilder.sslConnector(
    keyStore: KeyStore,
    keyAlias: String,
    keyStorePassword: () -> CharArray,
    privateKeyPassword: () -> CharArray,
    builder: EngineSSLConnectorBuilder.() -> Unit
): Unit

Adds a secure connector to this engine environment

stopServerOnCancellation

fun ApplicationEngine.stopServerOnCancellation(): CompletableJob

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