public class SimpleCookie extends Object implements Cookie
Cookie
implementation. 'HttpOnly' is supported out of the box, even on
Servlet 2.4
and 2.5
container implementations, using raw header writing logic and not
javax.servlet.http.Cookie
objects (which only has 'HttpOnly' support in Servlet
2.6
specifications and above).Modifier and Type | Field and Description |
---|---|
protected static String |
ATTRIBUTE_DELIMITER |
protected static String |
COMMENT_ATTRIBUTE_NAME |
protected static String |
COOKIE_DATE_FORMAT_STRING |
protected static String |
COOKIE_HEADER_NAME |
protected static long |
DAY_MILLIS |
static int |
DEFAULT_MAX_AGE
-1 , indicating the cookie should expire when the browser closes. |
static int |
DEFAULT_VERSION
-1 indicating that no version property should be set on the cookie. |
protected static String |
DOMAIN_ATTRIBUTE_NAME |
protected static String |
EXPIRES_ATTRIBUTE_NAME |
protected static String |
GMT_TIME_ZONE_ID |
protected static String |
HTTP_ONLY_ATTRIBUTE_NAME |
protected static String |
MAXAGE_ATTRIBUTE_NAME |
protected static String |
NAME_VALUE_DELIMITER |
protected static String |
PATH_ATTRIBUTE_NAME |
protected static String |
SECURE_ATTRIBUTE_NAME |
protected static String |
VERSION_ATTRIBUTE_NAME |
DELETED_COOKIE_VALUE, ONE_YEAR, ROOT_PATH
Constructor and Description |
---|
SimpleCookie() |
SimpleCookie(Cookie cookie) |
SimpleCookie(String name) |
Modifier and Type | Method and Description |
---|---|
protected String |
buildHeaderValue(String name,
String value,
String comment,
String domain,
String path,
int maxAge,
int version,
boolean secure,
boolean httpOnly) |
String |
getComment() |
String |
getDomain() |
int |
getMaxAge() |
String |
getName() |
String |
getPath() |
String |
getValue() |
int |
getVersion() |
boolean |
isHttpOnly() |
boolean |
isSecure() |
String |
readValue(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse ignored) |
void |
removeFrom(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
saveTo(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.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 |
setSecure(boolean secure) |
void |
setValue(String value) |
void |
setVersion(int version) |
public static final int DEFAULT_MAX_AGE
-1
, indicating the cookie should expire when the browser closes.public static final int DEFAULT_VERSION
-1
indicating that no version property should be set on the cookie.protected static final String NAME_VALUE_DELIMITER
protected static final String ATTRIBUTE_DELIMITER
protected static final long DAY_MILLIS
protected static final String GMT_TIME_ZONE_ID
protected static final String COOKIE_DATE_FORMAT_STRING
protected static final String COOKIE_HEADER_NAME
protected static final String PATH_ATTRIBUTE_NAME
protected static final String EXPIRES_ATTRIBUTE_NAME
protected static final String MAXAGE_ATTRIBUTE_NAME
protected static final String DOMAIN_ATTRIBUTE_NAME
protected static final String VERSION_ATTRIBUTE_NAME
protected static final String COMMENT_ATTRIBUTE_NAME
protected static final String SECURE_ATTRIBUTE_NAME
protected static final String HTTP_ONLY_ATTRIBUTE_NAME
public SimpleCookie()
public SimpleCookie(String name)
public SimpleCookie(Cookie cookie)
public String getComment()
getComment
in interface Cookie
public void setComment(String comment)
setComment
in interface Cookie
public int getVersion()
getVersion
in interface Cookie
public void setVersion(int version)
setVersion
in interface Cookie
public boolean isHttpOnly()
isHttpOnly
in interface Cookie
public void setHttpOnly(boolean httpOnly)
setHttpOnly
in interface Cookie
public void saveTo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
protected String buildHeaderValue(String name, String value, String comment, String domain, String path, int maxAge, int version, boolean secure, boolean httpOnly)
public void removeFrom(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
removeFrom
in interface Cookie
Copyright © 2004–2019 The Apache Software Foundation. All rights reserved.