Package rife.engine
Record Class SiteCookie
java.lang.Object
java.lang.Record
rife.engine.SiteCookie
- Record Components:
name- the name of the cookievalue- the value of the cookiehost- the host that set the cookie, which is the only host that it's sent to when there's no domaindomain- the domain the cookie was set for, which includes its subdomains, ornullfor only the host that set itpath- the path the cookie applies toexpires- when the cookie expires, in milliseconds since the epoch, or-1for a session cookie, which isn't stored and is forgotten together with its jarsecure- whether the cookie is only sent with secure requestshttpOnly- whether the cookie was marked as not visible to scriptssameSite- theSameSiteattribute, ornullwhen it wasn't set
public record SiteCookie(String name, String value, String host, String domain, String path, long expires, boolean secure, boolean httpOnly, String sameSite)
extends Record
A cookie as it's kept by a
SiteCookieJar, with an absolute expiry
so that it can be stored and restored later.- Since:
- 1.11.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondomain()Returns the value of thedomainrecord component.final booleanIndicates whether some other object is "equal to" this one.longexpires()Returns the value of theexpiresrecord component.final inthashCode()Returns a hash code value for this object.host()Returns the value of thehostrecord component.booleanhttpOnly()Returns the value of thehttpOnlyrecord component.booleanisExpired(long now) Indicates whether this cookie has expired at a particular moment.booleanIndicates whether this is a session cookie, which isn't stored and is forgotten together with its jar.name()Returns the value of thenamerecord component.path()Returns the value of thepathrecord component.sameSite()Returns the value of thesameSiterecord component.booleansecure()Returns the value of thesecurerecord component.final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
SiteCookie
public SiteCookie(String name, String value, String host, String domain, String path, long expires, boolean secure, boolean httpOnly, String sameSite) Creates an instance of aSiteCookierecord class.- Parameters:
name- the value for thenamerecord componentvalue- the value for thevaluerecord componenthost- the value for thehostrecord componentdomain- the value for thedomainrecord componentpath- the value for thepathrecord componentexpires- the value for theexpiresrecord componentsecure- the value for thesecurerecord componenthttpOnly- the value for thehttpOnlyrecord componentsameSite- the value for thesameSiterecord component
-
-
Method Details
-
isSessionCookie
public boolean isSessionCookie()Indicates whether this is a session cookie, which isn't stored and is forgotten together with its jar.- Returns:
trueif the cookie has no expiry; orfalseotherwise- Since:
- 1.11.0
-
isExpired
public boolean isExpired(long now) Indicates whether this cookie has expired at a particular moment.- Parameters:
now- the moment in milliseconds since the epoch- Returns:
trueif the cookie has expired; orfalseotherwise- Since:
- 1.11.0
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-
host
Returns the value of thehostrecord component.- Returns:
- the value of the
hostrecord component
-
domain
Returns the value of thedomainrecord component.- Returns:
- the value of the
domainrecord component
-
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-
expires
public long expires()Returns the value of theexpiresrecord component.- Returns:
- the value of the
expiresrecord component
-
secure
public boolean secure()Returns the value of thesecurerecord component.- Returns:
- the value of the
securerecord component
-
httpOnly
public boolean httpOnly()Returns the value of thehttpOnlyrecord component.- Returns:
- the value of the
httpOnlyrecord component
-
sameSite
Returns the value of thesameSiterecord component.- Returns:
- the value of the
sameSiterecord component
-