- java.lang.Object
-
- java.lang.Enum<SetCookie.SameSite>
-
- io.helidon.common.http.SetCookie.SameSite
-
- All Implemented Interfaces:
Serializable
,Comparable<SetCookie.SameSite>
- Enclosing class:
- SetCookie
public static enum SetCookie.SameSite extends Enum<SetCookie.SameSite>
The SameSite attribute of the Set-Cookie HTTP response header allows you to declare if your cookie should be restricted to a first-party or same-site context.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description LAX
Cookies are not sent on normal cross-site subrequests (for example to load images or frames into a third party site) , but are sent when a user is navigating to the origin site (i.e., when following a link).NONE
Cookies will be sent in all contexts, i.e.STRICT
Cookies will only be sent in a first-party context and not be sent along with requests initiated by third party websites.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
text()
Text to write to the same site cookie param.static SetCookie.SameSite
valueOf(String name)
Returns the enum constant of this type with the specified name.static SetCookie.SameSite[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
LAX
public static final SetCookie.SameSite LAX
Cookies are not sent on normal cross-site subrequests (for example to load images or frames into a third party site) , but are sent when a user is navigating to the origin site (i.e., when following a link). This is the default cookie value if SameSite has not been explicitly specified in recent browser versions
-
STRICT
public static final SetCookie.SameSite STRICT
Cookies will only be sent in a first-party context and not be sent along with requests initiated by third party websites.
-
NONE
public static final SetCookie.SameSite NONE
Cookies will be sent in all contexts, i.e. in responses to both first-party and cross-origin requests. If SameSite=None is set, the cookie Secure attribute must also be set (or the cookie will be blocked).
-
-
Method Detail
-
values
public static SetCookie.SameSite[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (SetCookie.SameSite c : SetCookie.SameSite.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static SetCookie.SameSite valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
text
public String text()
Text to write to the same site cookie param.- Returns:
- text to send in cookie
-
-