public interface Cookie
2.4
and 2.5
API (Servlet API 'native' support was only introduced in
the 2.6
specification).Modifier and Type | Interface and Description |
---|---|
static class |
Cookie.SameSiteOptions
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.
|
Modifier and Type | Field and Description |
---|---|
static String |
DELETED_COOKIE_VALUE
The value of deleted cookie (with the maxAge 0).
|
static int |
ONE_YEAR
The number of seconds in one year (= 60 * 60 * 24 * 365).
|
static String |
ROOT_PATH
Root path to use when the path hasn't been set and request context root is empty or null.
|
Modifier and Type | Method and Description |
---|---|
String |
getComment() |
String |
getDomain() |
int |
getMaxAge() |
String |
getName() |
String |
getPath() |
Cookie.SameSiteOptions |
getSameSite() |
String |
getValue() |
int |
getVersion() |
boolean |
isHttpOnly() |
boolean |
isSecure() |
String |
readValue(HttpServletRequest request,
HttpServletResponse response) |
void |
removeFrom(HttpServletRequest request,
HttpServletResponse response) |
void |
saveTo(HttpServletRequest request,
HttpServletResponse response) |
void |
setComment(String comment) |
void |
setDomain(String domain) |
void |
setHttpOnly(boolean httpOnly) |
void |
setMaxAge(int maxAge) |
void |
setName(String name) |
void |
setPath(String path) |
void |
setSameSite(Cookie.SameSiteOptions sameSite) |
void |
setSecure(boolean secure) |
void |
setValue(String value) |
void |
setVersion(int version) |
static final String DELETED_COOKIE_VALUE
static final int ONE_YEAR
static final String ROOT_PATH
String getComment()
void setComment(String comment)
int getMaxAge()
void setMaxAge(int maxAge)
boolean isSecure()
void setSecure(boolean secure)
int getVersion()
void setVersion(int version)
void setHttpOnly(boolean httpOnly)
boolean isHttpOnly()
void setSameSite(Cookie.SameSiteOptions sameSite)
Cookie.SameSiteOptions getSameSite()
void saveTo(HttpServletRequest request, HttpServletResponse response)
void removeFrom(HttpServletRequest request, HttpServletResponse response)
String readValue(HttpServletRequest request, HttpServletResponse response)
Copyright © 2004–2023 The Apache Software Foundation. All rights reserved.