vertx / io.vertx.ext.web / Cookie

Cookie

interface Cookie

Represents an HTTP Cookie.

All cookies must have a name and a value and can optionally have other fields set such as path, domain, etc.

(Derived from io.netty.handler.codec.http.Cookie)

Functions

cookie

open static fun cookie(name: String, value: String): Cookie

Create a new cookie

open static fun cookie(nettyCookie: Cookie): Cookie

Create a new cookie from a Netty cookie

encode

abstract fun encode(): String

Encode the cookie to a string. This is what is used in the Set-Cookie header

getDomain

abstract fun getDomain(): String

getName

abstract fun getName(): String

getPath

abstract fun getPath(): String

getValue

abstract fun getValue(): String

isChanged

abstract fun isChanged(): Boolean

Has the cookie been changed? Changed cookies will be saved out in the response and sent to the browser.

isFromUserAgent

abstract fun isFromUserAgent(): Boolean

Has this Cookie been sent from the User Agent (the browser)? or was created during the executing on the request.

setChanged

abstract fun setChanged(changed: Boolean): Unit

Set the cookie as being changed. Changed will be true for a cookie just created, false by default if just read from the request

setDomain

abstract fun setDomain(domain: String): Cookie

Sets the domain of this cookie

setHttpOnly

abstract fun setHttpOnly(httpOnly: Boolean): Cookie

Determines if this cookie is HTTP only. If set to true, this cookie cannot be accessed by a client side script. However, this works only if the browser supports it. For for information, please look here.

setMaxAge

abstract fun setMaxAge(maxAge: Long): Cookie

Sets the maximum age of this cookie in seconds. If an age of 0 is specified, this cookie will be automatically removed by browser because it will expire immediately. If Long#MIN_VALUE is specified, this cookie will be removed when the browser is closed. If you don't set this the cookie will be a session cookie and be removed when the browser is closed.

setPath

abstract fun setPath(path: String): Cookie

Sets the path of this cookie.

setSecure

abstract fun setSecure(secure: Boolean): Cookie

Sets the security getStatus of this cookie

setValue

abstract fun setValue(value: String): Cookie

Sets the value of this cookie