Class Cookies
public
class
Cookies
extends
Object
Provides access to browser cookies stored on the client. Because of browser
restrictions, you will only be able to access cookies associated with the
current page's domain.
Methods
Method Detail
getCookie
Gets the cookie associated with the given name.
Parameters
- name
- the name of the cookie to be retrieved
Return Value
the cookie's value, or
null
if the cookie doesn't exist
getCookieNames
Gets the names of all cookies in this page's domain.
Return Value
the names of all cookies
removeCookie
public static void
removeCookie(
String name)
Removes the cookie associated with the given name.
Parameters
- name
- the name of the cookie to be removed
setCookie
Sets a cookie. The cookie will expire when the current browser session is
ended.
Parameters
- name
- the cookie's name
- value
- the cookie's value
setCookie
Sets a cookie.
Parameters
- name
- the cookie's name
- value
- the cookie's value
- expires
- when the cookie expires
setCookie
Sets a cookie.
Parameters
- name
- the cookie's name
- value
- the cookie's value
- expires
- when the cookie expires
- domain
- the domain to be associated with this cookie
- path
- the path to be associated with this cookie
- secure
-
true
to make this a secure cookie