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
SimpleCookieimplementation.- 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 intcompareTo(Cookie c)Cookiedomain(java.lang.String domain)Sets the domain of the cookie.booleanequals(java.lang.Object o)java.lang.StringgetDomain()Gets the domain name of this Cookie.longgetMaxAge()java.lang.StringgetName()java.lang.StringgetPath()The path of the cookie.java.util.Optional<SameSite>getSameSite()Checks to see if thisCookiecan be sent along cross-site requests.java.lang.StringgetValue()inthashCode()CookiehttpOnly(boolean httpOnly)Sets whether the cookie is HTTP-Only.booleanisHttpOnly()Checks to see if thisCookiecan only be accessed via HTTP.booleanisSecure()CookiemaxAge(long maxAge)Sets the max age of the cookie in seconds.Cookiepath(java.lang.String path)Sets the path of the cookie.CookiesameSite(SameSite sameSite)Determines if this thisCookiecan be sent along cross-site requests.Cookiesecure(boolean secure)Sets whether the cookie is secure.java.lang.StringtoString()Cookievalue(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:CookieGets the domain name of this Cookie.Domain names are formatted according to RFC 2109.
-
getPath
public java.lang.String getPath()
Description copied from interface:CookieThe 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:CookieChecks to see if thisCookiecan only be accessed via HTTP. If this returns true, theCookiecannot be accessed through client side script - But only if the browser supports it.See here for reference
- Specified by:
isHttpOnlyin interfaceCookie- Returns:
- True if this
Cookieis 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:CookieChecks to see if thisCookiecan be sent along cross-site requests. For more information, please look here- Specified by:
getSameSitein 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:CookieSets the max age of the cookie in seconds.
-
value
@NonNull public Cookie value(@NonNull java.lang.String value)
Description copied from interface:CookieSets the value.
-
domain
@NonNull public Cookie domain(java.lang.String domain)
Description copied from interface:CookieSets the domain of the cookie.
-
path
@NonNull public Cookie path(java.lang.String path)
Description copied from interface:CookieSets the path of the cookie.
-
secure
@NonNull public Cookie secure(boolean secure)
Description copied from interface:CookieSets whether the cookie is secure.
-
httpOnly
@NonNull public Cookie httpOnly(boolean httpOnly)
Description copied from interface:CookieSets whether the cookie is HTTP-Only.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
compareTo
public int compareTo(Cookie c)
- Specified by:
compareToin interfacejava.lang.Comparable<Cookie>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-