StructedCookie

A desktop/JVM cookie backed by a string property map.

Use this type to create cookies for top.kagg886.wvbridge.cookie.WebViewPanelCookieManager.putCookie or to copy and modify cookies returned by the desktop cookie store. Desktop mutation methods require this concrete type; arbitrary implementations of Cookie are not accepted.

Supported map keys:

KeyValue
nameRequired, non-empty cookie name.
valueRequired cookie value; an empty string is allowed.
domainCookie domain; defaults to the target URI host when omitted during mutation.
pathCookie path; defaults to the target URI's default cookie path when omitted during mutation.
expiresTimeStampExpiration time in milliseconds since the Unix epoch, encoded as a decimal string.
httpOnlyBoolean string; defaults to false.
secureBoolean string; defaults to false.
sessionBoolean string; defaults to true when expiresTimeStamp is absent.
sameSiteNONE, LAX, or STRICT, subject to native backend support.

Boolean strings accept true, 1, yes, false, 0, and no, ignoring case. For a persistent cookie, provide expiresTimeStamp and omit session or set it to false. A session value of true causes the native bridge to ignore the expiration time. Native browser rules determine whether the resulting cookie is accepted.

Cookies are identified by name, domain, and path. Writing a cookie with the same identity updates it; cookies with different domains or paths can coexist. Removal uses this identity, not the value.

val cookie = StructedCookie(
mapOf(
"name" to "theme",
"value" to "dark",
"path" to "/",
"secure" to "true",
"sameSite" to "LAX",
),
)
// manager is a desktop WebViewPanelCookieManager.
manager.putCookie("https://example.com/", cookie)

val updated = StructedCookie(cookie.dict + ("value" to "light"))
manager.putCookie("https://example.com/", updated)

Construction does not validate or copy dict. Missing name or value entries cause their corresponding getters to throw NullPointerException; the native bridge also validates required fields when mutating the store. Prefer an immutable map and create a new instance for changes. Changing the map alone does not update the native cookie store.

Parameters

dict

Cookie attributes using the exact keys listed above. The expiration key is expiresTimeStamp, not expires; the public Cookie.expires extension formats it as an HTTP-date.

Constructors

Link copied to clipboard
constructor(dict: Map<String, String>)

Properties

Link copied to clipboard
actual val Cookie.domain: String?

Cookie domain attribute, when the current platform exposes it.

expect val Cookie.domain: String?

Cookie domain attribute, when the current platform exposes it.

actual val Cookie.domain: String?

Cookie domain attribute, when the current platform exposes it.

actual val Cookie.domain: String?

Cookie domain attribute, when the current platform exposes it.

Link copied to clipboard
actual val Cookie.expires: String?

Cookie expiration time as an HTTP-date, when available.

expect val Cookie.expires: String?

Cookie expiration time as an HTTP-date, when available.

actual val Cookie.expires: String?

Cookie expiration time as an HTTP-date, when available.

actual val Cookie.expires: String?

Cookie expiration time as an HTTP-date, when available.

Link copied to clipboard
actual val Cookie.httpOnly: Boolean?

Whether this cookie is marked HttpOnly, when the current platform exposes it.

expect val Cookie.httpOnly: Boolean?

Whether this cookie is marked HttpOnly, when the current platform exposes it.

actual val Cookie.httpOnly: Boolean?

Whether this cookie is marked HttpOnly, when the current platform exposes it.

actual val Cookie.httpOnly: Boolean?

Whether this cookie is marked HttpOnly, when the current platform exposes it.

Link copied to clipboard
open override val name: String

Cookie name from the required name entry.

Link copied to clipboard
actual val Cookie.path: String?

Cookie path attribute, when the current platform exposes it.

expect val Cookie.path: String?

Cookie path attribute, when the current platform exposes it.

actual val Cookie.path: String?

Cookie path attribute, when the current platform exposes it.

actual val Cookie.path: String?

Cookie path attribute, when the current platform exposes it.

Link copied to clipboard
actual val Cookie.sameSite: String?

Cookie SameSite attribute, usually NONE, LAX, or STRICT, when available.

expect val Cookie.sameSite: String?

Cookie SameSite attribute, usually NONE, LAX, or STRICT, when available.

actual val Cookie.sameSite: String?

Cookie SameSite attribute, usually NONE, LAX, or STRICT, when available.

actual val Cookie.sameSite: String?

Cookie SameSite attribute, usually NONE, LAX, or STRICT, when available.

Link copied to clipboard
actual val Cookie.secure: Boolean?

Whether this cookie is marked Secure, when the current platform exposes it.

expect val Cookie.secure: Boolean?

Whether this cookie is marked Secure, when the current platform exposes it.

actual val Cookie.secure: Boolean?

Whether this cookie is marked Secure, when the current platform exposes it.

actual val Cookie.secure: Boolean?

Whether this cookie is marked Secure, when the current platform exposes it.

Link copied to clipboard
actual val Cookie.session: Boolean?

Whether this cookie is a session cookie, when the current platform exposes it.

expect val Cookie.session: Boolean?

Whether this cookie is a session cookie, when the current platform exposes it.

actual val Cookie.session: Boolean?

Whether this cookie is a session cookie, when the current platform exposes it.

actual val Cookie.session: Boolean?

Whether this cookie is a session cookie, when the current platform exposes it.

Link copied to clipboard
open override val value: String

Cookie value from the required value entry.