public class DefaultCookie extends java.lang.Object implements Cookie
Cookie implementation.UNDEFINED_MAX_AGE| 构造器和说明 |
|---|
DefaultCookie(java.lang.String name,
java.lang.String value)
Creates a new cookie with the specified name and value.
|
| 限定符和类型 | 方法和说明 |
|---|---|
int |
compareTo(Cookie c) |
java.lang.String |
domain()
Returns the domain of this
Cookie. |
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
boolean |
isHttpOnly()
Checks to see if this
Cookie can only be accessed via HTTP. |
boolean |
isPartitioned()
Checks to see if this
Cookie is partitioned |
boolean |
isSecure()
Checks to see if this
Cookie is secure |
long |
maxAge()
Returns the maximum age of this
Cookie in seconds or Cookie.UNDEFINED_MAX_AGE if unspecified |
java.lang.String |
name()
Returns the name of this
Cookie. |
java.lang.String |
path()
Returns the path of this
Cookie. |
CookieHeaderNames.SameSite |
sameSite()
Checks to see if this
Cookie can be sent along cross-site requests. |
void |
setDomain(java.lang.String domain)
Sets the domain of this
Cookie. |
void |
setHttpOnly(boolean httpOnly)
Determines if this
Cookie is HTTP only. |
void |
setMaxAge(long maxAge)
Sets the maximum age of this
Cookie in seconds. |
void |
setPartitioned(boolean partitioned)
Sets the
Partitioned attribute of this Cookie |
void |
setPath(java.lang.String path)
Sets the path of this
Cookie. |
void |
setSameSite(CookieHeaderNames.SameSite sameSite)
Determines if this this
Cookie can be sent along cross-site requests. |
void |
setSecure(boolean secure)
Sets the security getStatus of this
Cookie |
void |
setValue(java.lang.String value)
Sets the value of this
Cookie. |
void |
setWrap(boolean wrap)
Sets true if the value of this
Cookie
is to be wrapped with double quotes. |
java.lang.String |
toString() |
protected java.lang.String |
validateValue(java.lang.String name,
java.lang.String value)
已过时。
CookieUtil is package private, will be removed once old Cookie API is dropped
|
java.lang.String |
value()
Returns the value of this
Cookie. |
boolean |
wrap()
Returns true if the raw value of this
Cookie,
was wrapped with double quotes in original Set-Cookie header. |
public DefaultCookie(java.lang.String name,
java.lang.String value)
public void setValue(java.lang.String value)
CookieCookie.public boolean wrap()
CookieCookie,
was wrapped with double quotes in original Set-Cookie header.public void setWrap(boolean wrap)
CookieCookie
is to be wrapped with double quotes.public void setDomain(java.lang.String domain)
CookieCookie.public long maxAge()
CookieCookie in seconds or Cookie.UNDEFINED_MAX_AGE if unspecifiedpublic void setMaxAge(long maxAge)
CookieCookie in seconds.
If an age of 0 is specified, this Cookie will be
automatically removed by browser because it will expire immediately.
If Cookie.UNDEFINED_MAX_AGE is specified, this Cookie will be removed when the
browser is closed.public void setSecure(boolean secure)
CookieCookiepublic boolean isHttpOnly()
CookieCookie can only be accessed via HTTP.
If this returns true, the Cookie cannot be accessed through
client side script - But only if the browser supports it.
For more information, please look hereisHttpOnly 在接口中 CookieCookie is HTTP-only or false if it isn'tpublic void setHttpOnly(boolean httpOnly)
CookieCookie 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 information, please look
here.setHttpOnly 在接口中 CookiehttpOnly - True if the Cookie is HTTP only, otherwise false.public CookieHeaderNames.SameSite sameSite()
Cookie can be sent along cross-site requests.
For more information, please look
herepublic void setSameSite(CookieHeaderNames.SameSite sameSite)
Cookie can be sent along cross-site requests.
For more information, please look
heresameSite - same-site-flag valuepublic boolean isPartitioned()
Cookie is partitionedCookie is partitioned, otherwise falsepublic void setPartitioned(boolean partitioned)
Partitioned attribute of this Cookiepartitioned - True if this Cookie is to be partitioned, otherwise falsepublic int hashCode()
hashCode 在类中 java.lang.Objectpublic boolean equals(java.lang.Object o)
equals 在类中 java.lang.Object@Deprecated
protected java.lang.String validateValue(java.lang.String name,
java.lang.String value)
IllegalArgumentException otherwise.
Only intended to be used by DefaultCookie.name - attribute namevalue - attribute valuepublic java.lang.String toString()
toString 在类中 java.lang.Object