Name

Cookie

Synopsis

Class Name:

javax.servlet.http.Cookie

Extends:

None

Implements:

Cloneable

Implemented by:

Internal container-dependent class. Most containers use the reference implementation of the class (developed in the Apache Jakarta project).

Description

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 comments, path and domain qualifiers, a maximum age, and a version number.

This class supports both the Version (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 to ensure the best interoperability.

Class Summary

public class Cookie implements Cloneable { // Constructor public Cookie(String name, String value); // Methods public Object clone( ); public String getComment( ); public String getDomain( ); public int getMaxAge( ); public String getName( ); public String getPath( ); public boolean getSecure( ); public String getValue( ); public int getVersion( ); public void setComment(String comment); public void setDomain(String domain); public void setMaxAge(int expiry); public void setPath(String uriPath); public void setSecure( ); public void setValue(String ...

Get Java Server Pages now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.