public class Cookie extends Object
| Constructor and Description |
|---|
Cookie() |
Cookie(String name,
String value)
Creates an new http-cookie
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
String |
getDomain() |
String |
getExpire() |
long |
getMaxAge() |
String |
getName() |
String |
getPath() |
String |
getSameSite() |
String |
getValue() |
boolean |
isHttpOnly() |
boolean |
isSecure() |
void |
setDomain(String domain)
Set the cookie domauin
Default is not defined
|
Cookie |
setExpire(Instant instant)
Set the cookie expire (GMT wherefore Instant)
Default is infinite
|
Cookie |
setHttpOnly(boolean httpOnly)
Set the if the cookie shouldn't accessible via JavaScript through the Document.cookie property
Default is false
|
Cookie |
setMaxAge(long maxAge)
Set the maximum age for this cookie in ms
Default is infinite
|
Cookie |
setName(String name)
Set the cookie name
|
Cookie |
setPath(String path)
Set the cookie path, also where the cookie should be send to the server
Default is root (/)
|
Cookie |
setSameSite(SameSite sameSite) |
Cookie |
setSecure(boolean secure)
Set the if the cookie should be only send via SSL
Default is false
|
Cookie |
setValue(String value)
Set the cookie value
|
String |
toString()
Build the string to an cookie-string.
|
public Cookie(String name, String value)
name - Cookie namevalue - Cookie valuepublic Cookie()
public String getName()
public Cookie setName(String name)
name - The namepublic String getValue()
public Cookie setValue(String value)
value - The valuepublic String getExpire()
public Cookie setExpire(Instant instant)
instant - The instantpublic String getPath()
public Cookie setPath(String path)
path - The pathpublic boolean isSecure()
public Cookie setSecure(boolean secure)
secure - if you want the cookie to be securepublic boolean isHttpOnly()
public Cookie setHttpOnly(boolean httpOnly)
httpOnly - if you want the cookie to be httpOnlypublic String getSameSite()
public long getMaxAge()
public Cookie setMaxAge(long maxAge)
maxAge - the maxage in millisecondspublic String getDomain()
public void setDomain(String domain)
domain - The domainCopyright © 2019. All rights reserved.