Package io.muserver
Class Cookie
- java.lang.Object
-
- io.muserver.Cookie
-
public class Cookie extends java.lang.ObjectA cookie that is sent from the server to the client.To create cookies, you can create a builder by calling
builder().
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CookieBuilderbuilder()Creates a new cookie builder with secure, Strict SameSite and httpOnly selected.java.lang.Stringdomain()booleanequals(java.lang.Object o)inthashCode()booleanisHttpOnly()booleanisSecure()longmaxAge()java.lang.Stringname()java.lang.Stringpath()java.lang.StringsameSite()java.lang.StringtoString()java.lang.Stringvalue()
-
-
-
Method Detail
-
name
public java.lang.String name()
- Returns:
- The cookie name
-
value
public java.lang.String value()
- Returns:
- The cookie value
-
domain
public java.lang.String domain()
- Returns:
- The domain this cookie is valid for
-
path
public java.lang.String path()
- Returns:
- The path this cookie applies to
-
maxAge
public long maxAge()
- Returns:
- The max age in seconds of this cookie
-
sameSite
public java.lang.String sameSite()
- Returns:
- The SameSite value of the cookie, for example "Strict", "Lax", or "None"
-
isSecure
public boolean isSecure()
- Returns:
- True if this cookie is only readable over https
-
isHttpOnly
public boolean isHttpOnly()
- Returns:
- True if this cookie is only available via HTTP. If false, client side script will not be able to read the cookie (if the client supports this).
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
builder
public static CookieBuilder builder()
Creates a new cookie builder with secure, Strict SameSite and httpOnly selected.- Returns:
- A new builder
-
-