Cookie

data class Cookie(val name: String, val value: String, val encoding: CookieEncoding = CookieEncoding.URI_ENCODING, val maxAge: Int = 0, val expires: GMTDate? = null, val domain: String? = null, val path: String? = null, val secure: Boolean = false, val httpOnly: Boolean = false, val extensions: Map<String, String?> = emptyMap())

Represents a cookie with name, content and a set of settings such as expiration, visibility and security. A cookie with neither expires nor maxAge is a session cookie.

Constructors

Link copied to clipboard
fun Cookie(name: String, value: String, encoding: CookieEncoding = CookieEncoding.URI_ENCODING, maxAge: Int = 0, expires: GMTDate? = null, domain: String? = null, path: String? = null, secure: Boolean = false, httpOnly: Boolean = false, extensions: Map<String, String?> = emptyMap())

Properties

Link copied to clipboard
val domain: String? = null

for which it is set

Link copied to clipboard
Link copied to clipboard
val expires: GMTDate? = null

date when it expires

Link copied to clipboard

additional cookie extensions

Link copied to clipboard
val httpOnly: Boolean = false

only transfer cookie over HTTP, no access from JavaScript

Link copied to clipboard
@get:JvmName(name = "getMaxAgeInt")
val maxAge: Int = 0

number of seconds to keep cookie

Link copied to clipboard
Link copied to clipboard
val path: String? = null

for which it is set

Link copied to clipboard
val secure: Boolean = false

send it via secure connection only

Link copied to clipboard