Package-level declarations

Contains the HTTP handlers implementation (on top of Core's general event handlers). It houses the HTTP handlers (AfterHandler, OnHandler, PathHandler and FilterHandler) and the HTTP predicate.

Types

Link copied to clipboard
data class AfterHandler(val serverPredicate: HttpServerPredicate = HttpServerPredicate(), val block: HttpCallback) : HttpHandler, Handler<HttpServerCall>
Link copied to clipboard
data class FilterHandler(val serverPredicate: HttpServerPredicate = HttpServerPredicate(), val block: HttpCallback) : HttpHandler, Handler<HttpServerCall>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
data class HttpServerContext(val event: HttpServerCall, val predicate: (Context<HttpServerCall>) -> Boolean, val nextHandlers: List<Handler<HttpServerCall>> = emptyList(), val nextHandler: Int = 0, val exception: Exception? = null, val attributes: Map<*, *> = emptyMap<Any, Any>()) : Context<HttpServerCall>
Link copied to clipboard
data class HttpServerPredicate(val methods: Set<HttpMethod> = emptySet(), val pathPattern: PathPattern = LiteralPathPattern(), val exception: KClass<out Exception>? = null, val status: HttpStatus? = null) : Function1<Context<HttpServerCall>, Boolean>
Link copied to clipboard
data class OnHandler(val serverPredicate: HttpServerPredicate = HttpServerPredicate(), val block: HttpCallback) : HttpHandler, Handler<HttpServerCall>
Link copied to clipboard
data class PathHandler(val serverPredicate: HttpServerPredicate, val handlers: List<HttpHandler>) : HttpHandler, Handler<HttpServerCall>
Link copied to clipboard
class ServerBuilder(var handlers: List<HttpHandler> = emptyList())

Functions

Link copied to clipboard
fun after(predicate: HttpServerPredicate = HttpServerPredicate(), callback: HttpCallback): AfterHandler
fun after(pattern: String, callback: HttpCallback): AfterHandler
fun after(method: HttpMethod, pattern: String = "", callback: HttpCallback): AfterHandler
fun after(methods: Set<HttpMethod> = emptySet(), pattern: String = "", exception: KClass<out Exception>? = null, status: HttpStatus? = null, callback: HttpCallback): AfterHandler
Link copied to clipboard
fun delete(pattern: String = "", callback: HttpCallback): OnHandler
Link copied to clipboard
inline fun <T : Exception> exception(status: HttpStatus? = null, noinline callback: HttpExceptionCallback<T>): AfterHandler
fun <T : Exception> exception(exception: KClass<T>? = null, status: HttpStatus? = null, callback: HttpExceptionCallback<T>): AfterHandler
Link copied to clipboard
fun filter(predicate: HttpServerPredicate = HttpServerPredicate(), callback: HttpCallback): FilterHandler
fun filter(pattern: String, callback: HttpCallback): FilterHandler
fun filter(method: HttpMethod, pattern: String = "", callback: HttpCallback): FilterHandler
fun filter(methods: Set<HttpMethod> = emptySet(), pattern: String = "", exception: KClass<out Exception>? = null, status: HttpStatus? = null, callback: HttpCallback): FilterHandler
Link copied to clipboard
fun get(pattern: String = "", callback: HttpCallback): OnHandler
Link copied to clipboard
fun head(pattern: String = "", callback: HttpCallback): OnHandler
Link copied to clipboard
fun on(predicate: HttpServerPredicate = HttpServerPredicate(), callback: HttpCallback): OnHandler
fun on(pattern: String, callback: HttpCallback): OnHandler
fun on(method: HttpMethod, pattern: String = "", callback: HttpCallback): OnHandler
fun on(methods: Set<HttpMethod> = emptySet(), pattern: String = "", exception: KClass<out Exception>? = null, status: HttpStatus? = null, callback: HttpCallback): OnHandler
Link copied to clipboard
fun options(pattern: String = "", callback: HttpCallback): OnHandler
Link copied to clipboard
fun patch(pattern: String = "", callback: HttpCallback): OnHandler
Link copied to clipboard
fun path(pattern: String = "", block: ServerBuilder.() -> Unit): PathHandler
fun path(contextPath: String = "", handlers: List<HttpHandler>): PathHandler
Link copied to clipboard
fun post(pattern: String = "", callback: HttpCallback): OnHandler
Link copied to clipboard
fun HttpCallback.process(request: HttpServerRequest, attributes: Map<*, *> = emptyMap<Any, Any>()): HttpServerContext
fun HttpCallback.process(method: HttpMethod = GET, protocol: HttpProtocol = HTTP, host: String = "localhost", port: Int = 80, path: String = "", queryParameters: QueryParameters = QueryParameters(), headers: Headers = Headers(), body: Any = "", parts: List<HttpPart> = emptyList(), formParameters: FormParameters = FormParameters(), cookies: List<Cookie> = emptyList(), contentType: ContentType? = null, certificateChain: List<X509Certificate> = emptyList(), accept: List<ContentType> = emptyList(), contentLength: Long = -1L, attributes: Map<*, *> = emptyMap<Any, Any>()): HttpServerContext
Link copied to clipboard
fun put(pattern: String = "", callback: HttpCallback): OnHandler
Link copied to clipboard
fun trace(pattern: String = "", callback: HttpCallback): OnHandler
Link copied to clipboard
fun ws(pattern: String = "", callback: HttpCallback): OnHandler