createApplicationPlugin
Creates an ApplicationPlugin that can be installed into an Application.
The example below create a plugin that prints a requested URL each time your application receives a call:
val RequestLoggingPlugin = createApplicationPlugin("RequestLoggingPlugin") {
onCall { call ->
println(call.request.uri)
}
}
application.install(RequestLoggingPlugin)
You can learn more from Custom plugins.
Parameters
A name of a plugin that is used to get its instance.
Defines how the initial PluginConfigT of your new plugin can be created. Note that it may be modified later when a user of your plugin calls Application.install.
Allows you to define handlers (onCall, onCallReceive, onCallRespond and so on) that can modify the behaviour of an Application where your plugin is installed.
Creates an ApplicationPlugin that can be installed into an Application.
The example below create a plugin that prints a requested URL each time your application receives a call:
val RequestLoggingPlugin = createApplicationPlugin("RequestLoggingPlugin") {
onCall { call ->
println(call.request.uri)
}
}
application.install(RequestLoggingPlugin)
You can learn more from Custom plugins.
Parameters
A name of a plugin that is used to get an instance of the plugin installed to the Application.
Allows you to define handlers (onCall, onCallReceive, onCallRespond and so on) that can modify the behaviour of an Application where your plugin is installed.