Package io.ktor.application

Types

Application

class Application : ApplicationCallPipeline, CoroutineScope

Represents configured and running web application, capable of handling requests. It is also the application coroutine scope that is cancelled immediately at application stop so useful for launching background coroutines.

ApplicationCall

interface ApplicationCall

Represents a single act of communication between client and server.

ApplicationCallPipeline

open class ApplicationCallPipeline : 
    Pipeline<Unit, ApplicationCall>

Pipeline configuration for executing ApplicationCall instances

ApplicationEnvironment

interface ApplicationEnvironment

Represents an environment in which Application runs

ApplicationEvents

class ApplicationEvents

Provides events for Application lifecycle

ApplicationFeature

interface ApplicationFeature<in TPipeline : Pipeline<*, ApplicationCall>, out TConfiguration : Any, TFeature : Any>

Defines an installable Application Feature

EventDefinition

class EventDefinition<T>

Definition of an event

Exceptions

DuplicateApplicationFeatureException

class DuplicateApplicationFeatureException : Exception

Thrown when Application Feature has been attempted to be installed with the same key as already installed Feature

MissingApplicationFeatureException

class MissingApplicationFeatureException : 
    IllegalStateException

Thrown when Application Feature has been attempted to be accessed but has not been installed before

Type Aliases

EventHandler

typealias EventHandler<T> = (T) -> Unit

Specifies signature for the event handler

Properties

ApplicationStarted

val ApplicationStarted: EventDefinition<Application>

Event definition for Application Started event

ApplicationStarting

val ApplicationStarting: EventDefinition<Application>

Event definition for Application Starting event

ApplicationStopPreparing

val ApplicationStopPreparing: EventDefinition<ApplicationEnvironment>

Event definition for an event that is fired when the application is going to stop

ApplicationStopped

val ApplicationStopped: EventDefinition<Application>

Event definition for Application Stopped event

ApplicationStopping

val ApplicationStopping: EventDefinition<Application>

Event definition for Application Stopping event

application

Current application for the context

call

Current call for the context

log

val Application.log: Logger

Convenience property to access log from application

Functions

feature

fun <A : Pipeline<*, ApplicationCall>, B : Any, F : Any> A.feature(
    feature: ApplicationFeature<A, B, F>
): F

Gets feature instance for this pipeline, or fails with MissingApplicationFeatureException if the feature is not installed

featureOrNull

fun <A : Pipeline<*, ApplicationCall>, B : Any, F : Any> A.featureOrNull(
    feature: ApplicationFeature<A, B, F>
): F?

Returns feature instance for this pipeline, or null if feature is not installed

install

fun <P : Pipeline<*, ApplicationCall>, B : Any, F : Any> P.install(
    feature: ApplicationFeature<P, B, F>,
    configure: B.() -> Unit = {}
): F

Installs feature into this pipeline, if it is not yet installed

uninstall

fun <A : Pipeline<*, ApplicationCall>, B : Any, F : Any> A.uninstall(
    feature: ApplicationFeature<A, B, F>
): Unit

Uninstalls feature from the pipeline

uninstallAllFeatures

fun <A : Pipeline<*, ApplicationCall>> A.uninstallAllFeatures(): Unit

Uninstalls all features from the pipeline

uninstallFeature

fun <A : Pipeline<*, ApplicationCall>, F : Any> A.uninstallFeature(
    key: AttributeKey<F>
): Unit

Uninstalls feature specified by key from the pipeline