Package io.micronaut.http.simple.cookies
Class SimpleCookie
java.lang.Object
io.micronaut.http.simple.cookies.SimpleCookie
- All Implemented Interfaces:
Cookie,Serializable,Comparable<Cookie>
Simple
Cookie implementation.- Since:
- 1.0
- Author:
- Vladimir Orany
- See Also:
-
Field Summary
Fields inherited from interface io.micronaut.http.cookie.Cookie
ATTRIBUTE_DOMAIN, ATTRIBUTE_EXPIRES, ATTRIBUTE_HTTP_ONLY, ATTRIBUTE_MAX_AGE, ATTRIBUTE_PATH, ATTRIBUTE_SAME_SITE, ATTRIBUTE_SECURE, UNDEFINED_MAX_AGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintSets the domain of the cookie.booleanGets the domain name of this Cookie.longGets the maximum age of the cookie in seconds.getName()getPath()The path of the cookie.Checks to see if thisCookiecan be sent along cross-site requests.getValue()inthashCode()httpOnly(boolean httpOnly) Sets whether the cookie is HTTP-Only.booleanChecks to see if thisCookiecan only be accessed via HTTP.booleanisSecure()maxAge(long maxAge) Sets the max age of the cookie in seconds.Sets the path of the cookie.Determines if thisCookiecan be sent along cross-site requests.secure(boolean secure) Sets whether the cookie is secure.toString()Sets the value.
-
Constructor Details
-
SimpleCookie
Constructor.- Parameters:
name- The namevalue- The value
-
-
Method Details
-
getName
-
getValue
-
getDomain
Description copied from interface:CookieGets the domain name of this Cookie.Domain names are formatted according to RFC 2109.
-
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()Description copied from interface:CookieGets the maximum age of the cookie in seconds. If the max age has not been explicitly set, then the value returned will beCookie.UNDEFINED_MAX_AGE, indicating that the Max-Age Attribute should not be written. -
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
Description copied from interface:Cookie -
maxAge
Description copied from interface:CookieSets the max age of the cookie in seconds. When not explicitly set, the max age will default toCookie.UNDEFINED_MAX_AGEand cause the Max-Age Attribute not to be encoded. -
value
Description copied from interface:CookieSets the value. -
domain
Description copied from interface:CookieSets the domain of the cookie. -
path
Description copied from interface:CookieSets the path of the cookie. -
secure
Description copied from interface:CookieSets whether the cookie is secure. -
httpOnly
Description copied from interface:CookieSets whether the cookie is HTTP-Only. -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<Cookie>
-
hashCode
public int hashCode() -
toString
-