public interface CookieSpi
Modifier and Type | Method and Description |
---|---|
String |
getAttribute(String name)
自定义属性,用于扩展
|
String |
getDomain()
限制 Cookie 主机作用域,一般包含子域名
Cookie 作用域,默认为空,表示所有域名下生效 |
String |
getName()
获取Cookie名称
|
String |
getPath()
限制 Cookie URL路径作用域,该 URL 路径必须存在于请求的 URL 中,子路径也会匹配
Cookie 作用域,默认为空,表示所有路径下生效 |
String |
getValue()
获取Cookie值
|
default boolean |
isExpired()
Cookie是否过期
|
boolean |
isExpired(Instant now)
Cookie是否过期
|
boolean |
isHostOnly()
限制 Cookie 主机作用域,一般包含子域名
Cookie 作用域,默认为空,表示所有域名下生效 |
boolean |
isHttpOnly()
限制 Cookie 的作用域
标记为 HttpOnly 的 Cookie 只能在 HTTP 协议中访问,不能通过脚本语言(如 JavaScript)访问 |
boolean |
isPersistent()
是否持久化,即Cookie是否在Session关闭前一直有效
|
boolean |
isSecure()
限制访问 Cookie
标记为 Secure 的 Cookie 只应通过被 HTTPS 协议加密过的请求发送给服务端 |
String getName()
String getValue()
boolean isSecure()
boolean isHttpOnly()
boolean isHostOnly()
String getDomain()
String getPath()
boolean isExpired(Instant now)
now
- 当前时间,用于判断是否过期default boolean isExpired()
boolean isPersistent()
Copyright © 2025. All rights reserved.