Route

interface Route

A builder for a routing tree.

Inheritors

Properties

Link copied to clipboard

Gets an Application for this RoutingNode by scanning the hierarchy to the root.

Link copied to clipboard
abstract val attributes: Attributes
Link copied to clipboard
Link copied to clipboard
abstract val parent: Route?

Functions

Link copied to clipboard
fun Route.accept(vararg contentTypes: ContentType, build: Route.() -> Unit): Route

Builds a route to match requests with the HttpHeaders.Accept header matching any of the specified contentTypes.

Link copied to clipboard
fun Route.contentType(contentType: ContentType, build: Route.() -> Unit): Route

Builds a route to match requests with the HttpHeaders.ContentType header matching the specified contentType.

Link copied to clipboard
abstract fun createChild(selector: RouteSelector): Route

Creates a child node in this node with a given selector or returns an existing one with the same selector.

Link copied to clipboard

Creates a routing entry for the specified path.

Link copied to clipboard

Builds a route to match DELETE requests.

Builds a route to match DELETE requests with the specified path.

Builds a route to match DELETE requests with the specified regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.

Link copied to clipboard

Builds a route to match GET requests.

fun Route.get(path: String, body: RoutingHandler): Route

Builds a route to match GET requests with the specified path.

fun Route.get(path: Regex, body: RoutingHandler): Route

Builds a route to match GET requests with the specified regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.

Link copied to clipboard
abstract fun handle(body: RoutingHandler)

Installs a handler into this route which is called when the route is selected for a call.

Link copied to clipboard

Builds a route to match HEAD requests.

fun Route.head(path: String, body: RoutingHandler): Route

Builds a route to match HEAD requests with the specified path.

fun Route.head(path: Regex, body: RoutingHandler): Route

Builds a route to match HEAD requests with the specified regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.

Link copied to clipboard
fun Route.header(name: String, value: String, build: Route.() -> Unit): Route

Builds a route to match a header with the specified name and value.

Link copied to clipboard
fun Route.host(host: String, port: Int = 0, build: Route.() -> Unit): Route

Creates a route to match a request's host and port. There are no any host resolutions/transformations applied to a host: a request host is treated as a string.

fun Route.host(hosts: List<String>, ports: List<Int> = emptyList(), build: Route.() -> Unit): Route
fun Route.host(hostPattern: Regex, port: Int = 0, build: Route.() -> Unit): Route

Creates a route to match a request host and port. There are no any host resolutions/transformations applied to a host: a request host is treated as a string.

fun Route.host(hosts: List<String>, hostPatterns: List<Regex>, ports: List<Int> = emptyList(), build: Route.() -> Unit): Route

Creates a route to match s request host and port. There are no any host resolutions/transformations applied to a host: a request host is treated as a string.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract fun <B : Any, F : Any> install(plugin: Plugin<ApplicationCallPipeline, B, F>, configure: B.() -> Unit = {}): F

Installs a plugin into this route, if it is not yet installed.

Link copied to clipboard
Link copied to clipboard
fun Route.localPort(port: Int, build: Route.() -> Unit): Route

Creates a route to match a port on which a call was received.

Link copied to clipboard
fun Route.method(method: HttpMethod, body: Route.() -> Unit): Route

Builds a route to match the specified HTTP method.

Link copied to clipboard
fun Route.optionalParam(name: String, build: Route.() -> Unit): Route

Builds a route to capture an optional parameter with specified name, if it exists.

Link copied to clipboard

Builds a route to match OPTIONS requests.

Builds a route to match OPTIONS requests with the specified path.

Builds a route to match OPTIONS requests with the specified regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.

Link copied to clipboard
fun Route.param(name: String, build: Route.() -> Unit): Route

Builds a route to match a parameter with the specified name and captures its value.

fun Route.param(name: String, value: String, build: Route.() -> Unit): Route

Builds a route to match a parameter with the specified name and value.

Link copied to clipboard

Builds a route to match PATCH requests.

@JvmName(name = "patchTyped")
inline fun <R : Any> Route.patch(crossinline body: suspend RoutingContext.(R) -> Unit): Route

Builds a route to match PATCH requests receiving a request body as content of the R type.

Builds a route to match PATCH requests with the specified path.

@JvmName(name = "patchTypedPath")
inline fun <R : Any> Route.patch(path: String, crossinline body: suspend RoutingContext.(R) -> Unit): Route

Builds a route to match PATCH requests with the specified path receiving a request body as content of the R type.

fun Route.patch(path: Regex, body: RoutingHandler): Route

Builds a route to match PATCH requests with the specified regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.

@JvmName(name = "patchTypedPath")
inline fun <R : Any> Route.patch(path: Regex, crossinline body: suspend RoutingContext.(R) -> Unit): Route

Builds a route to match PATCH requests with the specified regex path receiving a request body as content of the R type. Named parameters from regex can be accessed via ApplicationCall.parameters.

Link copied to clipboard
abstract fun <F : Any> plugin(plugin: Plugin<*, *, F>): F

Gets a plugin instance for this pipeline, or fails with MissingApplicationPluginException if the plugin is not installed.

Link copied to clipboard
fun Route.port(vararg ports: Int, build: Route.() -> Unit): Route

Creates a route to match a request port.

Link copied to clipboard

Builds a route to match POST requests.

@JvmName(name = "postTyped")
inline fun <R : Any> Route.post(crossinline body: suspend RoutingContext.(R) -> Unit): Route

Builds a route to match POST requests receiving a request body as content of the R type.

fun Route.post(path: String, body: RoutingHandler): Route

Builds a route to match POST requests with the specified path.

@JvmName(name = "postTypedPath")
inline fun <R : Any> Route.post(path: String, crossinline body: suspend RoutingContext.(R) -> Unit): Route

Builds a route to match POST requests with the specified path receiving a request body as content of the R type.

fun Route.post(path: Regex, body: RoutingHandler): Route

Builds a route to match POST requests with the specified regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.

@JvmName(name = "postTypedPath")
inline fun <R : Any> Route.post(path: Regex, crossinline body: suspend RoutingContext.(R) -> Unit): Route

Builds a route to match POST requests with the specified regex path receiving a request body as content of the R type. Named parameters from regex can be accessed via ApplicationCall.parameters.

Link copied to clipboard

Builds a route to match PUT requests.

@JvmName(name = "putTyped")
inline fun <R : Any> Route.put(crossinline body: suspend RoutingContext.(R) -> Unit): Route

Builds a route to match PUT requests receiving a request body as content of the R type.

fun Route.put(path: String, body: RoutingHandler): Route

Builds a route to match PUT requests with the specified path.

@JvmName(name = "putTypedPath")
inline fun <R : Any> Route.put(path: String, crossinline body: suspend RoutingContext.(R) -> Unit): Route

Builds a route to match PUT requests with the specified path receiving a request body as content of the R type.

fun Route.put(path: Regex, body: RoutingHandler): Route

Builds a route to match PUT requests with the specified regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.

@JvmName(name = "putTypedPath")
inline fun <R : Any> Route.put(path: Regex, crossinline body: suspend RoutingContext.(R) -> Unit): Route

Builds a route to match PUT requests with the specified regex path receiving a request body as content of the R type. Named parameters from regex can be accessed via ApplicationCall.parameters.

Link copied to clipboard
fun Route.route(path: String, build: Route.() -> Unit): Route

Builds a route to match the specified path.

fun Route.route(path: Regex, build: Route.() -> Unit): Route

Builds a route to match the specified regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.

fun Route.route(path: String, method: HttpMethod, build: Route.() -> Unit): Route

Builds a route to match the specified HTTP method and path.

fun Route.route(path: Regex, method: HttpMethod, build: Route.() -> Unit): Route

Builds a route to match the specified HTTP method and regex path. Named parameters from regex can be accessed via ApplicationCall.parameters.