kales / kales / KalesApplication

KalesApplication

class KalesApplication<T : ApplicationLayout>

Constructors

<init>

KalesApplication(application: Application, layout: KClass<T>)

Properties

routing

lateinit var routing: Routing

Functions

createCustomRequestMethodViaFormParamHandler

fun <T : ApplicationController> createCustomRequestMethodViaFormParamHandler(controllerClass: KClass<T>, path: String, actionName: String, method: String): Unit

Install a catch-all route that captures POST requests to any path and looks for a _method form parameter. If one is found, we then look for a DELETE/PATCH/PUT handler that matches that and rout to that handler instead. This is to work around a limitation where browsers don't support those verbs (only GET and POST) and it's the same workaround that Rails uses.

defaultRequestHandler

fun <T : ApplicationController> defaultRequestHandler(controllerClass: KClass<T>, actionName: String): suspend PipelineContext<Unit, ApplicationCall>.(Unit) -> Unit

delete

fun <T : ApplicationController> delete(path: String, actionName: String): Unit

get

fun <T : ApplicationController> get(path: String, actionName: String): Route

initRoutes

fun initRoutes(routes: KalesApplication<T>.() -> Unit): Unit

patch

fun <T : ApplicationController> patch(path: String, actionName: String): Unit

post

fun <T : ApplicationController> post(path: String, actionName: String): Route

put

fun <T : ApplicationController> put(path: String, actionName: String): Unit

Companion Object Properties

logger

val logger: Logger

Extension Functions

callSuspendMethod

suspend fun Any.callSuspendMethod(methodName: String, vararg args: Any?): Unit

Reflectively calls the provided suspend method with args