InvirtRequestContext
request
Returns the Request object for the current HTTP transaction.
- Example
- Declaration
println(InvirtRequestContext.request!!.uri)
val request: Request?
http4kRequestContexts
Invirt uses http4k's RequestContexts to store various information about the request, including validation errors and authentication principal in the security module.
Please note that at the time of this writing, http4k's only supports one instance of RequestContexts
per application. This means that if you are using Invirt you cannot create your custom RequestContexts
instance
and must use the one provided by Invirt.
- Declaration
val http4kRequestContexts = RequestContexts()
optionalKey()
Uses http4kRequestContexts
to create an optional RequestContextKey
with the specified value type. Exists mainly as a convenience for RequestContextKey.optional(InvirtRequestContext.http4kRequestContexts)
.
- Example
val key = InvirtRequestContext.optionalKey<String>()
requiredKey()
Uses http4kRequestContexts
to create a required RequestContextKey
with the specified value type. Exists mainly as a convenience for RequestContextKey.required(InvirtRequestContext.http4kRequestContexts)
- Example
val key = InvirtRequestContext.requiredKey<String>()
validationErrors
Returns the validation errors for the current request. This is used internally by Invirt to store validation errors and enable for them to be used in Pebble templates.
- Declaration
val errors: ValidationErrors?