public class Cookie
{
public boolean getHasKeys();
public Enumerator getKeys();
public String getItem(String itemName);
public String getValue();
public void setDomain(String domainName);
public void setExpires(Date d);
public void setItem(String name, String item);
public void setValue(String value);
public void setPath(String path);
public void setSecure(boolean secure);
}
Returns true if the cookie contains keys.
Returns an Enumerator that can be used to access the keys for the Cookie.
public String getItem(String itemName)
When getItem is called the cookie is assumed to be a dictionary cookie, and item is treated as the key. The value for the key itemName will be returned. In order to get the cookie string (non-parsed) or the value for a non-dictionary cookie, see getValue().
The value of the cookie is returned. If cookie is a dictionary key (i.e., getHasKeys() returns true) then the sequence of key/value pairs are URL-encoded and returned.
public void setDomain(String domainName)
Sets the Domain attribute of the Cookie to the specified value.
public void setExpires(Date d)
Sets the Expires attribute of the Cookie to the specified value. This date must be set in order for the cookie to be maintained after the session ends. If this attribute is not set to a date beyond the current date, the cookie will expire when the session ends.
public void setItem(String name, String item)
This treats the Cookie as a dictionary cookie and item is the value for the cookie's name.
public void setValue(String value);
This treats the Cookie as a simple cookie, and sets the cookies value to value.
public void setPath(String path)
Sets the Path attribute of the Cookie to path. You can use this method to specify that the cookie should be sent only to requests on a particular path. If this attribute is not set, the application path is used.
public void setSecure(boolean secure);
Sets the Secure attribute of the Cookie to the specified value. You can use this method to specify that a cookie is secure. If you set this value to true, a Secure flag will be added to the Set-Cookie header sent to the client. The Secure flag instructs the client to use only secure means to access the server when sending back the cookie.