public class Cookies extends Object
Modifier and Type | Method and Description |
---|---|
static String |
getCookie(String name)
Gets the cookie associated with the given name.
|
static Collection<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.
|
static void |
removeCookie(String name)
Removes the cookie associated with the given name.
|
static void |
removeCookie(String name,
String path)
Removes the cookie associated with the given name.
|
static void |
removeCookieNative(String name,
String path)
Native method to remove a cookie with a path.
|
static void |
setCookie(String name,
String value)
Sets a cookie.
|
static void |
setCookie(String name,
String value,
Date expires)
Sets a cookie.
|
static void |
setCookie(String name,
String value,
Date expires,
String domain,
String path,
boolean secure)
Sets a cookie.
|
static void |
setUriEncode(boolean encode)
Updates the URIencode flag and empties the cached cookies set.
|
public static String getCookie(String name)
name
- the name of the cookie to be retrievednull
if the cookie doesn't
existpublic static Collection<String> getCookieNames()
public static boolean getUriEncode()
public static boolean isCookieEnabled()
public static void removeCookie(String name)
name
- the name of the cookie to be removedpublic static void removeCookie(String name, 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(String name, String path)
public static void setCookie(String name, String value)
name
- the cookie's namevalue
- the cookie's valuepublic static void setCookie(String name, String value, Date expires)
name
- the cookie's namevalue
- the cookie's valueexpires
- when the cookie expirespublic static void setCookie(String name, String value, Date expires, String domain, 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)
Copyright © 2018. All rights reserved.