HttpCookie subclass with the additional attributes allowed in
the "Set-Cookie" response header. To build an instance use the from
static method.
| Modifier and Type | Class and Description |
|---|---|
| private static class | ResponseCookie.
Default implementation of |
| public static interface | ResponseCookie.
A builder for a server-defined HttpCookie with attributes. |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private final boolean | |
| private final Duration | |
| private final String | |
| private final String | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. other)Overrides org. Indicates whether some other object is "equal to" this one. |
| public static ResponseCookie. | |
| public static ResponseCookie. | |
| public static ResponseCookie. | Returns: a builder to create the cookie withthe cookie name name, final String the cookie value value)Factory method to obtain a builder for a server-defined cookie. |
| public String | |
| public Duration | |
| public String | |
| public String | |
| public int | hashCode()
Overrides org. Returns a hash code value for this object. |
| public boolean | |
| public boolean | |
| public ResponseCookie. | |
| public String | toString()
Overrides org. Returns a string representation of the object. |
| domain | back to summary |
|---|---|
| private final String domain
| |
| httpOnly | back to summary |
|---|---|
| private final boolean httpOnly | |
| maxAge | back to summary |
|---|---|
| private final Duration maxAge | |
| path | back to summary |
|---|---|
| private final String path
| |
| sameSite | back to summary |
|---|---|
| private final String sameSite
| |
| secure | back to summary |
|---|---|
| private final boolean secure | |
| ResponseCookie | back to summary |
|---|---|
| private ResponseCookie(String name, String value, Duration maxAge, String domain, String path, boolean secure, boolean httpOnly, String sameSite) Private constructor. See | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides org. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| from | back to summary |
|---|---|
| public static ResponseCookie. Factory method to obtain a builder for a server-defined cookie, given its name only, and where the value as well as other attributes can be set later via builder methods.
| |
| from | back to summary |
|---|---|
| public static ResponseCookie. Factory method to obtain a builder for a server-defined cookie that starts with a name-value pair and may also include attributes.
| |
| fromClientResponse | back to summary |
|---|---|
| public static ResponseCookie. Factory method to obtain a builder for a server-defined cookie. Unlike
| |
| getDomain | back to summary |
|---|---|
| public String getDomain() Return the cookie "Domain" attribute, or
| |
| getMaxAge | back to summary |
|---|---|
| public Duration getMaxAge() Return the cookie "Max-Age" attribute in seconds. A positive value indicates when the cookie expires relative to the current time. A value of 0 means the cookie should expire immediately. A negative value means no "Max-Age" attribute in which case the cookie is removed when the browser is closed. | |
| getPath | back to summary |
|---|---|
| public String getPath() Return the cookie "Path" attribute, or
| |
| getSameSite | back to summary |
|---|---|
| public String getSameSite() Return the cookie "SameSite" attribute, or This limits the scope of the cookie such that it will only be attached to
same site requests if
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides org. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isHttpOnly | back to summary |
|---|---|
| public boolean isHttpOnly() Return | |
| isSecure | back to summary |
|---|---|
| public boolean isSecure() Return | |
| mutate | back to summary |
|---|---|
| public ResponseCookie. Return a builder pre-populated with values from
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides org. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
ResponseCookieBuilder.
| Modifier and Type | Field and Description |
|---|---|
| private String | |
| private boolean | |
| private final boolean | |
| private Duration | |
| private final String | |
| private String | |
| private String | |
| private boolean | |
| private String |
| Access | Constructor and Description |
|---|---|
| public |
| domain | back to summary |
|---|---|
| private String domain
| |
| httpOnly | back to summary |
|---|---|
| private boolean httpOnly | |
| lenient | back to summary |
|---|---|
| private final boolean lenient | |
| maxAge | back to summary |
|---|---|
| private Duration maxAge | |
| name | back to summary |
|---|---|
| private final String name | |
| path | back to summary |
|---|---|
| private String path
| |
| sameSite | back to summary |
|---|---|
| private String sameSite
| |
| secure | back to summary |
|---|---|
| private boolean secure | |
| value | back to summary |
|---|---|
| private String value
| |
| DefaultResponseCookieBuilder | back to summary |
|---|---|
| public DefaultResponseCookieBuilder(String name, String value, boolean lenient) | |
| build | back to summary |
|---|---|
| public ResponseCookie build() Implements org. Doc from org. Create the HttpCookie.
| |
| domain | back to summary |
|---|---|
| public ResponseCookie. Implements org. Doc from org. Set the cookie "Domain" attribute.
| |
| httpOnly | back to summary |
|---|---|
| public ResponseCookie. Implements org. Doc from org. Add the "HttpOnly" attribute to the cookie.
| |
| initDomain | back to summary |
|---|---|
private String initDomain(String domain)
| |
| maxAge | back to summary |
|---|---|
| public ResponseCookie. Implements org. Doc from org. Set the cookie "Max-Age" attribute. A positive value indicates when the cookie should expire relative to the current time. A value of 0 means the cookie should expire immediately. A negative value results in no "Max-Age" attribute in which case the cookie is removed when the browser is closed.
| |
| maxAge | back to summary |
|---|---|
| public ResponseCookie. Implements org. Doc from org. Variant of
| |
| path | back to summary |
|---|---|
| public ResponseCookie. Implements org. Doc from org. Set the cookie "Path" attribute.
| |
| sameSite | back to summary |
|---|---|
| public ResponseCookie. Implements org. Doc from org. Add the "SameSite" attribute to the cookie. This limits the scope of the cookie such that it will only be
attached to same site requests if
| |
| secure | back to summary |
|---|---|
| public ResponseCookie. Implements org. Doc from org. Add the "Secure" attribute to the cookie.
| |
| value | back to summary |
|---|---|
| public ResponseCookie. Implements org. Doc from org. Set the cookie value.
| |
| Modifier and Type | Method and Description |
|---|---|
| public ResponseCookie | |
| public ResponseCookie. | |
| public ResponseCookie. | |
| public ResponseCookie. | |
| public ResponseCookie. | |
| public ResponseCookie. | |
| public ResponseCookie. | |
| public ResponseCookie. | |
| public ResponseCookie. |
| build | back to summary |
|---|---|
| public ResponseCookie build() Create the HttpCookie. | |
| domain | back to summary |
|---|---|
| public ResponseCookie. Set the cookie "Domain" attribute. | |
| httpOnly | back to summary |
|---|---|
| public ResponseCookie. Add the "HttpOnly" attribute to the cookie. | |
| maxAge | back to summary |
|---|---|
| public ResponseCookie. Set the cookie "Max-Age" attribute. A positive value indicates when the cookie should expire relative to the current time. A value of 0 means the cookie should expire immediately. A negative value results in no "Max-Age" attribute in which case the cookie is removed when the browser is closed. | |
| maxAge | back to summary |
|---|---|
| public ResponseCookie. Variant of | |
| path | back to summary |
|---|---|
| public ResponseCookie. Set the cookie "Path" attribute. | |
| sameSite | back to summary |
|---|---|
| public ResponseCookie. Add the "SameSite" attribute to the cookie. This limits the scope of the cookie such that it will only be
attached to same site requests if
| |
| secure | back to summary |
|---|---|
| public ResponseCookie. Add the "Secure" attribute to the cookie. | |
| value | back to summary |
|---|---|
| public ResponseCookie. Set the cookie value.
| |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static void | |
| public static void | |
| public static void | |
| public static void |
| DOMAIN_CHARS | back to summary |
|---|---|
| private static final String DOMAIN_CHARS | |
| SEPARATOR_CHARS | back to summary |
|---|---|
| private static final String SEPARATOR_CHARS | |
| Rfc6265Utils | back to summary |
|---|---|
| private Rfc6265Utils() | |
| validateCookieName | back to summary |
|---|---|
| public static void validateCookieName(String name) | |
| validateCookieValue | back to summary |
|---|---|
| public static void validateCookieValue(String value) | |
| validateDomain | back to summary |
|---|---|
| public static void validateDomain(String domain) | |
| validatePath | back to summary |
|---|---|
| public static void validatePath(String path) | |