open class Route : ApplicationCallPipeline
Describes a node in a routing tree.
parent
- is a parent node in the tree, or null for root node.
selector
- is an instance of RouteSelector for this node.
developmentMode
- is flag to switch report level for stack traces.
Route(parent: Route?, selector: RouteSelector) Route(parent: Route?, selector: RouteSelector, developmentMode: Boolean)
Describes a node in a routing tree. |
val children: List<Route>
List of child routes for this node |
|
val parent: Route?
is a parent node in the tree, or null for root node. |
|
val selector: RouteSelector
is an instance of RouteSelector for this node. |
val developmentMode: Boolean |
|
val receivePipeline: ApplicationReceivePipeline
Pipeline for receiving content |
|
val sendPipeline: ApplicationSendPipeline
Pipeline for sending content |
open fun afterIntercepted(): Unit |
|
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 |
|
fun handle(handler: <ERROR CLASS><Unit, ApplicationCall>): Unit
Installs a handler into this route which will be called when the route is selected for a call |
|
operator fun invoke(body: Route.() -> Unit): Unit
Allows using route instance for building additional routes |
|
open fun toString(): String |
val Route.application: Application
Gets an Application for this Route by scanning the hierarchy to the root |
|
val ApplicationCallPipeline.conversionService: ConversionService
Lookup for a conversion service. Returns the default one if the feature wasn't installed |
|
var Route.staticBasePackage: String?
Base package for relative resources calculations for static content |
|
var Route.staticRootFolder: File?
Base folder for relative files calculations for static content |
fun Route.accept(contentType: ContentType, build: Route.() -> Unit): Route
Builds a route to match requests with HttpHeaders.Accept header matching specified contentType |
|
fun Route.contentType(contentType: ContentType, build: Route.() -> Unit): Route
Builds a route to match requests with HttpHeaders.ContentType header matching specified contentType |
|
fun Route.createRouteFromPath(path: String): Route
Create a routing entry for specified path |
|
fun Route.default(localPath: String): Unit fun Route.default(localPath: File): Unit
Specifies localPath as a default file to serve when folder is requested |
|
fun Route.defaultResource(resource: String, resourcePackage: String? = null): Unit
Specifies resource as a default resources to serve when folder is requested |
|
fun Route.delete(path: String, body: <ERROR CLASS><Unit, ApplicationCall>): Route
Builds a route to match fun Route.delete(body: <ERROR CLASS><Unit, ApplicationCall>): Route
Builds a route to match |
|
fun Route.file(remotePath: String, localPath: String = remotePath): Unit fun Route.file(remotePath: String, localPath: File): Unit
Sets up routing to serve localPath file as remotePath |
|
fun Route.files(folder: String): Unit fun Route.files(folder: File): Unit
Sets up routing to serve all files from folder |
|
fun Route.get(path: String, body: <ERROR CLASS><Unit, ApplicationCall>): Route
Builds a route to match fun Route.get(body: <ERROR CLASS><Unit, ApplicationCall>): Route
Builds a route to match |
|
fun Route.head(path: String, body: <ERROR CLASS><Unit, ApplicationCall>): Route
Builds a route to match fun Route.head(body: <ERROR CLASS><Unit, ApplicationCall>): Route
Builds a route to match |
|
fun Route.header(name: String, value: String, build: Route.() -> Unit): Route
Builds a route to match header with specified name and value |
|
fun Route.host(host: String, port: Int = 0, build: Route.() -> Unit): Route fun Route.host(hostPattern: Regex, port: Int = 0, build: Route.() -> Unit): Route fun Route.host(hosts: List<String>, ports: List<Int> = emptyList(), build: Route.() -> Unit): Route fun Route.host(hosts: List<String>, hostPatterns: List<Regex>, ports: List<Int> = emptyList(), build: Route.() -> Unit): Route
Create a route to match 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.localPort(port: Int, build: Route.() -> Unit): Route
Create a route to match the port on which the call was received. |
|
fun Route.method(method: HttpMethod, body: Route.() -> Unit): Route
Builds a route to match specified method |
|
fun Route.optionalParam(name: String, build: Route.() -> Unit): Route
Builds a route to optionally capture parameter with specified name, if it exists |
|
fun Route.options(path: String, body: <ERROR CLASS><Unit, ApplicationCall>): Route
Builds a route to match fun Route.options(body: <ERROR CLASS><Unit, ApplicationCall>): Route
Builds a route to match |
|
fun Route.param(name: String, value: String, build: Route.() -> Unit): Route
Builds a route to match parameter with specified name and value fun Route.param(name: String, build: Route.() -> Unit): Route
Builds a route to match parameter with specified name and capture its value |
|
fun Route.patch(path: String, body: <ERROR CLASS><Unit, ApplicationCall>): Route
Builds a route to match fun Route.patch(body: <ERROR CLASS><Unit, ApplicationCall>): Route
Builds a route to match fun <R : Any> Route.patch(body: suspend PipelineContext<Unit, ApplicationCall>.(R) -> Unit): Route
Builds a route to match fun <R : Any> Route.patch(path: String, body: suspend PipelineContext<Unit, ApplicationCall>.(R) -> Unit): Route
Builds a route to match |
|
fun Route.port(vararg ports: Int, build: Route.() -> Unit): Route
Create a route to match request port. |
|
fun Route.post(path: String, body: <ERROR CLASS><Unit, ApplicationCall>): Route
Builds a route to match fun <R : Any> Route.post(body: suspend PipelineContext<Unit, ApplicationCall>.(R) -> Unit): Route
Builds a route to match fun <R : Any> Route.post(path: String, body: suspend PipelineContext<Unit, ApplicationCall>.(R) -> Unit): Route
Builds a route to match fun Route.post(body: <ERROR CLASS><Unit, ApplicationCall>): Route
Builds a route to match |
|
fun Route.preCompressed(vararg types: CompressedFileType = CompressedFileType.values(), configure: Route.() -> Unit): Unit
Support pre-compressed files in the file system only (not just any classpath resource) |
|
fun Route.put(path: String, body: <ERROR CLASS><Unit, ApplicationCall>): Route
Builds a route to match fun Route.put(body: <ERROR CLASS><Unit, ApplicationCall>): Route
Builds a route to match fun <R : Any> Route.put(body: suspend PipelineContext<Unit, ApplicationCall>.(R) -> Unit): Route
Builds a route to match fun <R : Any> Route.put(path: String, body: suspend PipelineContext<Unit, ApplicationCall>.(R) -> Unit): Route
Builds a route to match |
|
fun Route.resource(remotePath: String, resource: String = remotePath, resourcePackage: String? = null): Unit
Sets up routing to serve resource as remotePath in resourcePackage |
|
fun Route.resources(resourcePackage: String? = null): Unit
Sets up routing to serve all resources in resourcePackage |
|
fun Route.route(path: String, build: Route.() -> Unit): Route
Builds a route to match specified path fun Route.route(path: String, method: HttpMethod, build: Route.() -> Unit): Route
|
|
fun Route.static(configure: Route.() -> Unit): Route
Create a block for static content fun Route.static(remotePath: String, configure: Route.() -> Unit): Route
Create a block for static content at specified remotePath |
class Routing : Route
Root routing node for an Application |