Package dev.voidframework.web.http
Record Class Cookie
java.lang.Object
java.lang.Record
dev.voidframework.web.http.Cookie
- Record Components:
name- The cookie namevalue- The cookie valuedomain- The cookie domainpath- The cookie pathisHttpOnly- Is the cookie only be accessed via HTTP?isSecure- Is the cookie secured? If true, sent only for HTTPS requestssameSiteMode- The same site mode (None, Lax, or Strict)timeToLive- The cookie time to live
public record Cookie(String name, String value, String domain, String path, boolean isHttpOnly, boolean isSecure, String sameSiteMode, Duration timeToLive)
extends Record
A Cookie.
-
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.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theisHttpOnlyrecord component.booleanisSecure()Returns the value of theisSecurerecord component.name()Returns the value of thenamerecord component.static CookieBuild a new Cookie.static Cookieof(String name, String value, boolean isHttpOnly, boolean isSecure, String sameSiteMode, Duration timeToLive) Build a new Cookie.static CookieBuild a new Cookie.static CookieBuild a new Cookie.path()Returns the value of thepathrecord component.Returns the value of thesameSiteModerecord component.Returns the value of thetimeToLiverecord component.final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
Cookie
public Cookie(String name, String value, String domain, String path, boolean isHttpOnly, boolean isSecure, String sameSiteMode, Duration timeToLive) Creates an instance of aCookierecord class.- Parameters:
name- the value for thenamerecord componentvalue- the value for thevaluerecord componentdomain- the value for thedomainrecord componentpath- the value for thepathrecord componentisHttpOnly- the value for theisHttpOnlyrecord componentisSecure- the value for theisSecurerecord componentsameSiteMode- the value for thesameSiteModerecord componenttimeToLive- the value for thetimeToLiverecord component
-
-
Method Details
-
of
Build a new Cookie.- Parameters:
name- The cookie namevalue- The cookie value- Returns:
- Newly created cookie
-
of
public static Cookie of(String name, String value, boolean isHttpOnly, boolean isSecure, Duration timeToLive) Build a new Cookie.- Parameters:
name- The cookie namevalue- The cookie valueisHttpOnly- Is the cookie only be accessed via HTTP? isSecureisSecure- Is the cookie secured? If true, sent only for HTTPStimeToLive- The cookie time to live- Returns:
- Newly created cookie
-
of
public static Cookie of(String name, String value, boolean isHttpOnly, boolean isSecure, String sameSiteMode, Duration timeToLive) Build a new Cookie.- Parameters:
name- The cookie namevalue- The cookie valueisHttpOnly- Is the cookie only be accessed via HTTP? isSecureisSecure- Is the cookie secured? If true, sent only for HTTPSsameSiteMode- The same site mode (None, Lax, or Strict)timeToLive- The cookie time to live- Returns:
- Newly created cookie
-
of
Build a new Cookie.- Parameters:
name- The cookie namevalue- The cookie valuetimeToLive- The cookie time to live- Returns:
- Newly created cookie
-
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
-
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
-
isHttpOnly
public boolean isHttpOnly()Returns the value of theisHttpOnlyrecord component.- Returns:
- the value of the
isHttpOnlyrecord component
-
isSecure
public boolean isSecure()Returns the value of theisSecurerecord component.- Returns:
- the value of the
isSecurerecord component
-
sameSiteMode
Returns the value of thesameSiteModerecord component.- Returns:
- the value of the
sameSiteModerecord component
-
timeToLive
Returns the value of thetimeToLiverecord component.- Returns:
- the value of the
timeToLiverecord component
-