Package io.micronaut.http.simple.cookies
Class SimpleCookie
- java.lang.Object
-
- io.micronaut.http.simple.cookies.SimpleCookie
-
public class SimpleCookie extends java.lang.Object implements Cookie
SimpleCookie
implementation.- Since:
- 1.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SimpleCookie(java.lang.String name, java.lang.String value)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Cookie c)
Cookie
domain(java.lang.String domain)
Sets the domain of the cookie.boolean
equals(java.lang.Object o)
java.lang.String
getDomain()
Gets the domain name of this Cookie.long
getMaxAge()
java.lang.String
getName()
java.lang.String
getPath()
The path of the cookie.java.util.Optional<SameSite>
getSameSite()
Checks to see if thisCookie
can be sent along cross-site requests.java.lang.String
getValue()
int
hashCode()
Cookie
httpOnly(boolean httpOnly)
Sets whether the cookie is HTTP-Only.boolean
isHttpOnly()
Checks to see if thisCookie
can only be accessed via HTTP.boolean
isSecure()
Cookie
maxAge(long maxAge)
Sets the max age of the cookie in seconds.Cookie
path(java.lang.String path)
Sets the path of the cookie.Cookie
sameSite(SameSite sameSite)
Determines if this thisCookie
can be sent along cross-site requests.Cookie
secure(boolean secure)
Sets whether the cookie is secure.java.lang.String
toString()
Cookie
value(java.lang.String value)
Sets the value.
-
-
-
Method Detail
-
getName
@NonNull public java.lang.String getName()
-
getValue
@NonNull public java.lang.String getValue()
-
getDomain
public java.lang.String getDomain()
Description copied from interface:Cookie
Gets the domain name of this Cookie.Domain names are formatted according to RFC 2109.
-
getPath
public java.lang.String getPath()
Description copied from interface:Cookie
The path of the cookie. The cookie is visible to all paths below the request path on the server.
-
isHttpOnly
public boolean isHttpOnly()
Description copied from interface:Cookie
Checks to see if thisCookie
can only be accessed via HTTP. If this returns true, theCookie
cannot be accessed through client side script - But only if the browser supports it.See here for reference
- Specified by:
isHttpOnly
in interfaceCookie
- Returns:
- True if this
Cookie
is HTTP-only or false if it isn't
-
isSecure
public boolean isSecure()
-
getMaxAge
public long getMaxAge()
-
getSameSite
public java.util.Optional<SameSite> getSameSite()
Description copied from interface:Cookie
Checks to see if thisCookie
can be sent along cross-site requests. For more information, please look here- Specified by:
getSameSite
in interfaceCookie
- Returns:
- The SameSite attribute of the cookie
-
sameSite
@NonNull public Cookie sameSite(SameSite sameSite)
Description copied from interface:Cookie
-
maxAge
@NonNull public Cookie maxAge(long maxAge)
Description copied from interface:Cookie
Sets the max age of the cookie in seconds.
-
value
@NonNull public Cookie value(@NonNull java.lang.String value)
Description copied from interface:Cookie
Sets the value.
-
domain
@NonNull public Cookie domain(java.lang.String domain)
Description copied from interface:Cookie
Sets the domain of the cookie.
-
path
@NonNull public Cookie path(java.lang.String path)
Description copied from interface:Cookie
Sets the path of the cookie.
-
secure
@NonNull public Cookie secure(boolean secure)
Description copied from interface:Cookie
Sets whether the cookie is secure.
-
httpOnly
@NonNull public Cookie httpOnly(boolean httpOnly)
Description copied from interface:Cookie
Sets whether the cookie is HTTP-Only.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
compareTo
public int compareTo(Cookie c)
- Specified by:
compareTo
in interfacejava.lang.Comparable<Cookie>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-