public class SimpleCookie extends java.lang.Object implements Cookie
Cookie
implementation.Constructor and Description |
---|
SimpleCookie(java.lang.String name,
java.lang.String value)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Cookie c) |
Cookie |
domain(java.lang.String domain)
Sets the domain of the cookie.
|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getDomain()
Gets the domain name of this Cookie.
|
long |
getMaxAge() |
java.lang.String |
getName() |
java.lang.String |
getPath()
The path of the cookie.
|
java.util.Optional<SameSite> |
getSameSite()
Checks to see if this
Cookie can be sent along cross-site requests. |
java.lang.String |
getValue() |
int |
hashCode() |
Cookie |
httpOnly(boolean httpOnly)
Sets whether the cookie is HTTP-Only.
|
boolean |
isHttpOnly()
Checks to see if this
Cookie can only be accessed via HTTP. |
boolean |
isSecure() |
Cookie |
maxAge(long maxAge)
Sets the max age of the cookie in seconds.
|
Cookie |
path(java.lang.String path)
Sets the path of the cookie.
|
Cookie |
sameSite(SameSite sameSite)
Determines if this this
Cookie can be sent along cross-site requests. |
Cookie |
secure(boolean secure)
Sets whether the cookie is secure.
|
java.lang.String |
toString() |
Cookie |
value(java.lang.String value)
Sets the value.
|
public SimpleCookie(java.lang.String name, java.lang.String value)
name
- The namevalue
- The value@NonNull public java.lang.String getName()
@NonNull public java.lang.String getValue()
public java.lang.String getDomain()
Cookie
Domain names are formatted according to RFC 2109.
public java.lang.String getPath()
Cookie
public boolean isHttpOnly()
Cookie
Cookie
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.
See here for reference
isHttpOnly
in interface Cookie
Cookie
is HTTP-only or false if it isn'tpublic boolean isSecure()
public long getMaxAge()
public java.util.Optional<SameSite> getSameSite()
Cookie
Cookie
can be sent along cross-site requests.
For more information, please look
heregetSameSite
in interface Cookie
@NonNull public Cookie sameSite(SameSite sameSite)
Cookie
@NonNull public Cookie maxAge(long maxAge)
Cookie
@NonNull public Cookie value(@NonNull java.lang.String value)
Cookie
@NonNull public Cookie domain(java.lang.String domain)
Cookie
@NonNull public Cookie path(java.lang.String path)
Cookie
@NonNull public Cookie secure(boolean secure)
Cookie
@NonNull public Cookie httpOnly(boolean httpOnly)
Cookie
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int compareTo(Cookie c)
compareTo
in interface java.lang.Comparable<Cookie>
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object