Index
port_http_server / com.hexagonkt.http.server
Package com.hexagonkt.http.server¶
This package defines the classes used in the HTTP DSL.
Types¶
Name | Summary |
---|---|
Call | HTTP request context. It holds client supplied data and methods to change the response.class Call |
CorsSettings | HTTP CORS setting. It holds info for CORS.data class CorsSettings |
ErrorCodeCallback | Alias for errors' callbacks. Functions executed to handle a HTTP error code.typealias ErrorCodeCallback = Call .(CodedException) -> Unit |
ExceptionCallback | Alias for exceptions' callbacks. Functions executed when an exception is thrown.typealias ExceptionCallback = Call .( Exception ) -> Unit |
FilterOrder | Type of filter. Indicates when the filter is executed.enum class FilterOrder |
PortHttpServerSamplesTest | abstract class PortHttpServerSamplesTest |
Request | Lists would be initialized loading all elements when they are used (set it as lazy in implementations) this will have a performance penalty in favor of ease of use. The alternative would be using a 'Map/List wrapper that delegates calls to abstract methods in the interface (I won't do this just now).abstract class Request |
RequestHandler | Base class for request handlers.sealed class RequestHandler |
Response | Check 'Request' comment. And also note that lists should be updated by engines after callback is processed, this data is like a buffer that needs to be dumped to the real response.abstract class Response |
RouteCallback | Alias for routes' and filters' callbacks. Functions executed when a route is matched.typealias RouteCallback = Call .() -> Unit |
Router | Creates and initializes a Router based on a code block.class Router |
Server | A server that listen to HTTP connections on a port and address and route requests using a router.data class Server |
ServerPort | Represents a server instance of one kind.interface ServerPort |
ServerSettings | Holds server settings info.data class ServerSettings |
Session | Provides session information.abstract class Session |
Functions¶
Name | Summary |
---|---|
parseAllParameters | This function aggregates path parameters, form parameters and query parameters into a map and convert it into given class using object mapper Usage : request.parseAllParameters(MyCustomDataClass::class)fun <T : Any > Request .parseAllParameters(type: KClass <T>): T? |
serve | Creates a server and starts it.fun serve(settings: ServerSettings = ServerSettings(), router: Router , adapter: ServerPort = InjectionManager.inject()): Server fun serve(settings: ServerSettings = ServerSettings(), adapter: ServerPort = InjectionManager.inject(), block: Router .() -> Unit ): Server |