Package io.ktor.locations

Types

KtorExperimentalLocationsAPI
Link copied to clipboard
annotation class KtorExperimentalLocationsAPI
API marked with this annotation is experimental and is not guaranteed to be stable.
Location
Link copied to clipboard
annotation class Location(path: String)
Annotation for classes that will act as typed routes.
LocationAttributeRouteService
Link copied to clipboard
class LocationAttributeRouteService : LocationRouteService
Implements LocationRouteService by extracting routing information from a Location annotation.
LocationInfo
Link copied to clipboard
data class LocationInfo
A location class/object registration info.
LocationPropertyInfo
Link copied to clipboard
abstract class LocationPropertyInfo
Represents a location's property
LocationRouteService
Link copied to clipboard
interface LocationRouteService
Provides services for extracting routing information from a location class.
LocationRoutingException
Link copied to clipboard
class LocationRoutingException(message: String) : Exception
Exception indicating that route parameters in curly brackets do not match class properties.
Locations
Link copied to clipboard
open class Locations constructor(application: Application, routeService: LocationRouteService)
Ktor feature that allows to handle and construct routes in a typed way.

Functions

delete
Link copied to clipboard
inline fun <T : Any> Route.delete(noinline body: suspend PipelineContext<Unit, ApplicationCall>.(T) -> Unit): Route
Registers a typed handler body for a DELETE location defined by class T.
get
Link copied to clipboard
inline fun <T : Any> Route.get(noinline body: suspend PipelineContext<Unit, ApplicationCall>.(T) -> Unit): Route
Registers a typed handler body for a GET location defined by class T.
handle
Link copied to clipboard
inline fun <T : Any> Route.handle(noinline body: suspend PipelineContext<Unit, ApplicationCall>.(T) -> Unit)
Registers a handler body for a location defined by class T.
fun <T : Any> Route.handle(dataClass: KClass<T>, body: suspend PipelineContext<Unit, ApplicationCall>.(T) -> Unit)
Registers a handler body for a location defined by class dataClass.
head
Link copied to clipboard
inline fun <T : Any> Route.head(noinline body: suspend PipelineContext<Unit, ApplicationCall>.(T) -> Unit): Route
Registers a typed handler body for a HEAD location defined by class T.
href
Link copied to clipboard
fun PipelineContext<Unit, ApplicationCall>.href(location: Any): String
Renders link to a location using current installed locations service
location
Link copied to clipboard
inline fun <T : Any> ApplicationCall.location(): T
Retrieves the current call's location or fails if it is not available (request is not handled by a location class), or not yet available (invoked too early before the locations feature takes place).
inline fun <T : Any> Route.location(noinline body: Route.() -> Unit): Route
Registers a route body for a location defined by class T.
fun <T : Any> Route.location(data: KClass<T>, body: Route.() -> Unit): Route
Registers a route body for a location defined by class data.
locationOrNull
Link copied to clipboard
inline fun <T : Any> ApplicationCall.locationOrNull(): T
Retrieves the current call's location or fails if it is not available (request is not handled by a location class), or not yet available (invoked too early before the locations feature takes place).
options
Link copied to clipboard
inline fun <T : Any> Route.options(noinline body: suspend PipelineContext<Unit, ApplicationCall>.(T) -> Unit): Route
Registers a typed handler body for a OPTIONS location defined by class T.
patch
Link copied to clipboard
inline fun <T : Any> Route.patch(noinline body: suspend PipelineContext<Unit, ApplicationCall>.(T) -> Unit): Route
Registers a typed handler body for a PATCH location defined by class T.
post
Link copied to clipboard
inline fun <T : Any> Route.post(noinline body: suspend PipelineContext<Unit, ApplicationCall>.(T) -> Unit): Route
Registers a typed handler body for a POST location defined by class T.
put
Link copied to clipboard
inline fun <T : Any> Route.put(noinline body: suspend PipelineContext<Unit, ApplicationCall>.(T) -> Unit): Route
Registers a typed handler body for a PUT location defined by class T.
url
Link copied to clipboard
fun ApplicationCall.url(location: Any, block: URLBuilder.() -> Unit = {}): String
Constructs a String with the url of a instance location whose class must be annotated with Location.

Properties

locations
Link copied to clipboard
val PipelineContext<Unit, ApplicationCall>.locations: Locations
Gets the Application.locations feature
locations
Link copied to clipboard
val ApplicationCall.locations: Locations
Gets the Application.locations feature
locations
Link copied to clipboard
val Application.locations: Locations
Gets the Application.locations feature