PluginBuilder

abstract class PluginBuilder<PluginConfig : Any>

A utility class to build an ApplicationPlugin instance.

Functions

Link copied to clipboard
fun <HookHandler> on(hook: Hook<HookHandler>, handler: HookHandler)

Specifies a handler for a specific hook. A hook can be a specific place in time or event during the request processing like application shutdown, an exception during call processing, etc.

Link copied to clipboard
fun onCall(block: suspend OnCallContext<PluginConfig>.(call: ApplicationCall) -> Unit)

Specifies the block handler for every incoming ApplicationCall.

Link copied to clipboard
fun onCallReceive(block: suspend OnCallReceiveContext<PluginConfig>.(call: ApplicationCall) -> Unit)
fun onCallReceive(block: suspend OnCallReceiveContext<PluginConfig>.(call: ApplicationCall, body: Any) -> Unit)

Specifies the block handler that allows you to obtain and transform data received from the client. This block is invoked for every attempt to receive the request body.

Link copied to clipboard
fun onCallRespond(block: suspend OnCallRespondContext<PluginConfig>.(call: ApplicationCall) -> Unit)
fun onCallRespond(block: suspend OnCallRespondContext<PluginConfig>.(call: ApplicationCall, body: Any) -> Unit)

Specifies the block handler that allows you to transform data before sending it to the client. This handler is executed when the call.respond function is invoked in a route handler.

Properties

Link copied to clipboard
abstract val application: Application

A reference to the Application where the plugin is installed.

Link copied to clipboard
val applicationConfig: ApplicationConfig?

A configuration of your current application (incl. host, port and anything else you can define in application.conf).

Link copied to clipboard
val environment: ApplicationEnvironment?

Allows you to access the environment of the currently running application where the plugin is installed.

Link copied to clipboard
abstract val pluginConfig: PluginConfig

A configuration of the current plugin.