Request

class Request(adapter: RequestPort)

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).

HTTP request context. It holds client supplied data and methods to change the response.

Constructors

Link copied to clipboard
fun Request(adapter: RequestPort)

Functions

Link copied to clipboard
fun allParameters(): Map<String, Any>

Aggregates path parameters, form parameters and query parameters into a map.

Link copied to clipboard
inline fun <T : Any> body(): T

Parses request body.

fun <T : Any> body(type: KClass<T>): T

Parses request body according to given type.

Link copied to clipboard
inline fun <T : Any> bodyObjects(): List<T>

Parses request body objects.

fun <T : Any> bodyObjects(type: KClass<T>): List<T>

Parses request body objects to given type.

Properties

Link copied to clipboard
val accept: String?

First value in "Accept" header key.

Link copied to clipboard
val acceptValues: List<String>

List of parameters for "Accept" header key.

Link copied to clipboard
val body: String

Request body sent by the client.

Link copied to clipboard
val certificate: X509Certificate?

First certificate in the certificateChain.

Link copied to clipboard
val certificateChain: List<X509Certificate>

Provides a List of certificate chain used for SSL.

Link copied to clipboard
val contentLength: Long

Length of the request body.

Link copied to clipboard
val contentType: String?

Content type of the request body.

Link copied to clipboard
val cookies: Map<String, Cookie>

Map of the cookies contained in the browser.

Link copied to clipboard
val formParameters: Map<String, String>

Provides a Map of first values of all form fields.

Link copied to clipboard
val formParametersValues: Map<String, List<String>>

Provides Map of request parameters contained in form fields.

Link copied to clipboard
val headers: Map<String, String>

Map of first values of the headers of the request.

Link copied to clipboard
val headersValues: Map<String, List<String>>

Map of header values of the request.

Link copied to clipboard
val host: String

Provides the fully qualified name of the client.

Link copied to clipboard
val ip: String

Provides the client IP address.

Link copied to clipboard
val method: Method

Provides the HTTP method of the request.

Link copied to clipboard
val origin: String?

First value of "Origin" header key.

Link copied to clipboard
val parts: Map<String, Part>

Provides a Map of multipart parts in the request.

Link copied to clipboard
val path: String

Provides the servlet path of the request.

Link copied to clipboard
val pathParameters: Map<String, String>

Provides a Map of all path parameters.

Link copied to clipboard
val port: Int

Provides the port number used to make the request.

Link copied to clipboard
val preferredType: String?

Preferred content-type specified under "Accept" header key.

Link copied to clipboard
val queryParameters: Map<String, String>

Provides a Map of first values of all query parameters in the request.

Link copied to clipboard
val queryParametersValues: Map<String, List<String>>

Provides Map of parsed key-value pairs of query parameters in the request.

Link copied to clipboard
val queryString: String

Provides the query string of the request.

Link copied to clipboard
val referer: String?

First value of "Referer" header key.

Link copied to clipboard
val scheme: String

Provides the name of the scheme used to make this request.

Link copied to clipboard
val secure: Boolean

Check if the request is secure.

Link copied to clipboard
val url: String

Provides the URL client used to make the request.

Link copied to clipboard
val userAgent: String?

First value of "User-Agent" header key.