public class Cookies
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) static java.util.HashMap<java.lang.String,java.lang.String> |
cachedCookies
Cached copy of cookies.
|
(package private) static java.lang.String |
rawCookies
Raw cookie string stored to allow cached cookies to be invalidated on
write.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getCookie(java.lang.String name)
Gets the cookie associated with the given name.
|
static java.util.Collection<java.lang.String> |
getCookieNames()
Gets the names of all cookies in this page's domain.
|
static boolean |
getUriEncode()
Gets the URIencode flag.
|
static boolean |
isCookieEnabled()
Checks whether or not cookies are enabled or disabled.
|
(package private) static void |
loadCookies(java.util.HashMap<java.lang.String,java.lang.String> m) |
static void |
removeCookie(java.lang.String name)
Removes the cookie associated with the given name.
|
static void |
removeCookie(java.lang.String name,
java.lang.String path)
Removes the cookie associated with the given name.
|
static void |
removeCookieNative(java.lang.String name,
java.lang.String path)
Native method to remove a cookie with a path.
|
static void |
setCookie(java.lang.String name,
java.lang.String value)
Sets a cookie.
|
static void |
setCookie(java.lang.String name,
java.lang.String value,
java.util.Date expires)
Sets a cookie.
|
static void |
setCookie(java.lang.String name,
java.lang.String value,
java.util.Date expires,
java.lang.String domain,
java.lang.String path,
boolean secure)
Sets a cookie.
|
static void |
setUriEncode(boolean encode)
Updates the URIencode flag and empties the cached cookies set.
|
static java.util.HashMap<java.lang.String,java.lang.String> cachedCookies
static java.lang.String rawCookies
public static java.lang.String getCookie(java.lang.String name)
name
- the name of the cookie to be retrievednull
if the cookie doesn't
existpublic static java.util.Collection<java.lang.String> getCookieNames()
public static boolean getUriEncode()
public static boolean isCookieEnabled()
public static void removeCookie(java.lang.String name)
name
- the name of the cookie to be removedpublic static void removeCookie(java.lang.String name, java.lang.String path)
name
- the name of the cookie to be removedpath
- the path to be associated with this cookie (which should match
the path given in setCookie(java.lang.String, java.lang.String)
)public static void removeCookieNative(java.lang.String name, java.lang.String path)
public static void setCookie(java.lang.String name, java.lang.String value)
name
- the cookie's namevalue
- the cookie's valuepublic static void setCookie(java.lang.String name, java.lang.String value, java.util.Date expires)
name
- the cookie's namevalue
- the cookie's valueexpires
- when the cookie expirespublic static void setCookie(java.lang.String name, java.lang.String value, java.util.Date expires, java.lang.String domain, java.lang.String path, boolean secure)
name
- the cookie's namevalue
- the cookie's valueexpires
- when the cookie expiresdomain
- the domain to be associated with this cookiepath
- the path to be associated with this cookiesecure
- true
to make this a secure cookie (that is, only
accessible over an SSL connection)public static void setUriEncode(boolean encode)
static void loadCookies(java.util.HashMap<java.lang.String,java.lang.String> m)