Locations

open class Locations

EXPERIMENTAL Ktor feature that allows to handle and construct routes in a typed way.

You have to create data classes/objects representing parameterized routes and annotate them with Location. Then you can register sub-routes and handlers for those locations and create links to them using Locations.href.

Types

Configuration

class Configuration

Configuration for Locations.

Feature

companion object Feature : 
    ApplicationFeature<Application, Configuration, Locations>

Installable feature for Locations.

Constructors

<init>

Locations(
    application: Application,
    routeService: LocationRouteService)

EXPERIMENTAL Ktor feature that allows to handle and construct routes in a typed way.

Functions

createEntry

fun createEntry(
    parent: Route,
    locationClass: KClass<*>
): Route

Creates all necessary routing entries to match specified locationClass.

href

fun href(location: Any): String

Constructs the url for location.

resolve

fun <T : Any> resolve(
    locationClass: KClass<*>,
    call: ApplicationCall
): T

Resolves parameters in a call to an instance of specified locationClass.

fun <T : Any> resolve(
    locationClass: KClass<*>,
    parameters: Parameters
): T

Resolves parameters to an instance of specified locationClass.

Companion Object Properties

key

Unique key that identifies a feature

Companion Object Functions

install

fun install(
    pipeline: Application,
    configure: Configuration.() -> Unit
): Locations

Feature installation script