Package io.muserver
Class Cookie
- java.lang.Object
-
- io.muserver.Cookie
-
public class Cookie extends java.lang.Object
A 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 CookieBuilder
builder()
Creates a new cookie builder with secure, Strict SameSite and httpOnly selected.java.lang.String
domain()
boolean
equals(java.lang.Object o)
int
hashCode()
boolean
isHttpOnly()
boolean
isSecure()
long
maxAge()
java.lang.String
name()
java.lang.String
path()
java.lang.String
sameSite()
java.lang.String
toString()
java.lang.String
value()
-
-
-
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:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
builder
public static CookieBuilder builder()
Creates a new cookie builder with secure, Strict SameSite and httpOnly selected.- Returns:
- A new builder
-
-