public interface Cookie
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
DOMAIN_ATTR |
static String |
EXPIRES_ATTR |
static String |
HTTP_ONLY_ATTR |
static String |
MAX_AGE_ATTR |
static String |
PATH_ATTR |
static String |
SECURE_ATTR |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
containsAttribute(String name) |
String |
getAttribute(String name) |
Date |
getCreationDate()
已过时。
|
default Instant |
getCreationInstant()
Returns creation time of the cookie.
|
String |
getDomain()
Returns domain attribute of the cookie.
|
Date |
getExpiryDate()
已过时。
Use {
getExpiryInstant()} |
default Instant |
getExpiryInstant()
Returns the expiration
Instant of the cookie, or null if none exists. |
String |
getName()
Returns the name.
|
String |
getPath()
Returns the path attribute of the cookie.
|
String |
getValue()
Returns the value.
|
boolean |
isExpired(Date date)
已过时。
Use {
isExpired(Instant)} |
default boolean |
isExpired(Instant date)
Returns true if this cookie has expired.
|
default boolean |
isHttpOnly()
Checks whether this Cookie has been marked as
httpOnly. |
boolean |
isPersistent()
Returns
false if the cookie should be discarded at the end
of the "session"; true otherwise. |
boolean |
isSecure()
Indicates whether this cookie requires a secure connection.
|
boolean containsAttribute(String name)
String getName()
String getValue()
@Deprecated Date getExpiryDate()
getExpiryInstant()}Date of the cookie, or null
if none exists.
Note: the object returned by this method is considered immutable. Changing it (e.g. using setTime()) could result in undefined behaviour. Do so at your peril.
Date, or null.default Instant getExpiryInstant()
Instant of the cookie, or null if none exists.
Note: the object returned by this method is considered immutable. Changing it (e.g. using setTime()) could result in undefined behaviour. Do so at your peril.
Instant, or null.boolean isPersistent()
false if the cookie should be discarded at the end
of the "session"; true otherwise.false if the cookie should be discarded at the end
of the "session"; true otherwiseString getDomain()
String getPath()
boolean isSecure()
true if this cookie should only be sent
over secure connections, false otherwise.@Deprecated boolean isExpired(Date date)
isExpired(Instant)}date - Current timetrue if the cookie has expired.default boolean isExpired(Instant date)
date - Current timetrue if the cookie has expired.@Deprecated Date getCreationDate()
getCreationInstant()default Instant getCreationInstant()
default boolean isHttpOnly()
httpOnly.
The default implementation returns false.
httpOnly,
false otherwiseCopyright © 2023. All rights reserved.