Name
Cookie
Synopsis
A Cookie
object represents an HTTP cookie -- a
small amount of information sent by a servlet to a web browser, saved
by the browser, and later sent back to the server with new requests.
A cookie’s value can uniquely identify a client, so
cookies are commonly used for session management. A cookie has a
name, a single value, and optional attributes such as a comment, path
and domain qualifiers, a maximum age, and a version number.
This class supports both the Version 0 (the informal specification first introduced by Netscape) and the Version 1 (formally defined by RFC 2109) cookie specifications. By default, cookies are created using Version 0 to ensure the best interoperability.
Synopsis
|
Class name: |
|
|
Extends: |
None |
|
Implements: |
|
|
Implemented by: |
Internal container-dependent class. Most containers use the reference implementation of the class (developed in the Apache Jakarta project). |
Constructor
-
public Cookie(String name, String value) Creates a new instance with the specified name and value. The name must conform to RFC 2109, meaning it can’t contain commas, semicolon, whitespace, or start with a dollar sign.
Methods
-
public Object clone( ) Overrides the standard
Object.clone( )method to return a copy of this cookie.-
public String getComment( ) Returns the comment describing the purpose of this cookie or
nullif the cookie has no comment. For a cookie received from the browser, this method always returnsnull.-
public ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access