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:
| Key | Value |
|---|---|
name | Required, non-empty cookie name. |
value | Required cookie value; an empty string is allowed. |
domain | Cookie domain; defaults to the target URI host when omitted during mutation. |
path | Cookie path; defaults to the target URI's default cookie path when omitted during mutation. |
expiresTimeStamp | Expiration time in milliseconds since the Unix epoch, encoded as a decimal string. |
httpOnly | Boolean string; defaults to false. |
secure | Boolean string; defaults to false. |
session | Boolean string; defaults to true when expiresTimeStamp is absent. |
sameSite | NONE, 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
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.
Properties
Whether this cookie is marked HttpOnly, when the current platform exposes it.
Whether this cookie is marked HttpOnly, when the current platform exposes it.
Whether this cookie is marked HttpOnly, when the current platform exposes it.
Cookie SameSite attribute, usually NONE, LAX, or STRICT, when available.
Cookie SameSite attribute, usually NONE, LAX, or STRICT, when available.
Cookie SameSite attribute, usually NONE, LAX, or STRICT, when available.
Whether this cookie is marked Secure, when the current platform exposes it.
Whether this cookie is marked Secure, when the current platform exposes it.
Whether this cookie is marked Secure, when the current platform exposes it.
Whether this cookie is a session cookie, when the current platform exposes it.
Whether this cookie is a session cookie, when the current platform exposes it.
Whether this cookie is a session cookie, when the current platform exposes it.