Package io.ktor.application

Types

Link copied to clipboard
class Application(environment: ApplicationEnvironment) : 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.

Link copied to clipboard
interface ApplicationCall

Represents a single act of communication between client and server.

Link copied to clipboard
open class ApplicationCallPipeline(developmentMode: Boolean) : Pipeline<Unit, ApplicationCall>

Pipeline configuration for executing ApplicationCall instances

Link copied to clipboard
interface ApplicationEnvironment

Represents an environment in which Application runs

Link copied to clipboard
class ApplicationEvents

Provides events for Application lifecycle

Link copied to clipboard
interface ApplicationFeature<in TPipeline : Pipeline<*, ApplicationCall>, out TConfiguration : Any, TFeature : Any>

Defines an installable Application Feature

Link copied to clipboard
class DuplicateApplicationFeatureException(message: String) : Exception

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

Link copied to clipboard
open class EventDefinition<T>

Definition of an event. Event is used as a key so both hashCode and equals need to be implemented properly. Inheriting of this class is an experimental feature. Instantiate directly if inheritance not necessary.

Link copied to clipboard
typealias EventHandler<T> = (T) -> Unit

Specifies signature for the event handler

Link copied to clipboard
class MissingApplicationFeatureException(key: AttributeKey<*>) : IllegalStateException, CopyableThrowable<MissingApplicationFeatureException>

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

Functions

Link copied to clipboard
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

Link copied to clipboard
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

Link copied to clipboard
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

Link copied to clipboard
fun <A : Pipeline<*, ApplicationCall>, B : Any, F : Any> A.uninstall(feature: ApplicationFeature<A, B, F>)

Uninstalls feature from the pipeline

Link copied to clipboard
fun <A : Pipeline<*, ApplicationCall>> A.uninstallAllFeatures()

Uninstalls all features from the pipeline

Link copied to clipboard
fun <A : Pipeline<*, ApplicationCall>, F : Any> A.uninstallFeature(key: AttributeKey<F>)

Uninstalls feature specified by key from the pipeline

Properties

Link copied to clipboard
val PipelineContext<*, ApplicationCall>.application: Application

Current application for the context

Link copied to clipboard
val ApplicationStarted: EventDefinition<Application>

Event definition for Application Started event

Link copied to clipboard
val ApplicationStarting: EventDefinition<Application>

Event definition for Application Starting event

Link copied to clipboard
val ApplicationStopped: EventDefinition<Application>

Event definition for Application Stopped event

Link copied to clipboard
val ApplicationStopping: EventDefinition<Application>

Event definition for Application Stopping event

Link copied to clipboard

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

Link copied to clipboard
val PipelineContext<*, ApplicationCall>.call: ApplicationCall

Current call for the context

Link copied to clipboard
val Application.log: Logger

Convenience property to access log from application