Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
HydraExpress C++ API Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

rwsf::Cookie

Group:  Servlet


Does not inherit

Local Index

Members

Header File

#include rwsf/servlet/http/Cookie.h

Description

rwsf::Cookie represents an HTTP cookie. A cookie is a small piece of data sent from the server to the client. The client stores the cookie and returns it to the server with later requests. Cookies are typically used to store a small amount of state on the client. If the application requires little state, cookies can maintain the complete state of the application. Otherwise, the application will save the application state on the server and send the client a cookie with a unique token. On later requests, the client returns the token. The application uses the token to associate the saved state with the request. This class provides a simple API for working with cookies.

Each cookie consists of a name, a value, and a set of optional attributes. To add a cookie to a response, use the addCookie function of rwsf::HttpServletResponse. To access cookies in a request, use either the getCookie function or the getCookies function of rwsf::HttpServletRequest.

rwsf::Cookie provides support for both Version 0 (Netscape) and Version 1 (RFC 2109) cookies. However, due to portability concerns we recommend that you use Version 0 cookies (the default).

Note that HydraExpress includes classes that encapsulate the details of associating saved state with a client. For some applications, these classes can eliminate the need for working with cookies directly. See rwsf::HttpSession and related classes for details.

The following table lists methods that are either non-standard or not supported in this release.

constructors and assignment operator

added constructors and assignment operator

getExpires()setExpires()

added methods for getting and setting expiration on version 0 cookies

clone()

not included in this implementation (functionality replaced by assignment operator and copy constructor).

Public Constructors

Cookie();
Cookie(const std::string & name);
Cookie(const std::string & name,
    const std::string & value);
Cookie(const Cookie & second);

Public Destructors

~Cookie();

Public Member Functions

std::string
getComment() const;
std::string
getDomain() const;
std::string
getExpires() const;
int
getMaxAge() const;
std::string
getName() const;
std::string
getPath() const;
bool
getSecure() const;
std::string
getValue() const;
int
getVersion() const;
void
setComment(const std::string & purpose);
void
setDomain(const std::string & pattern);
void
setExpires(const std::string & expiry);
void
setMaxAge(int seconds);
void
setPath(const std::string & uri);
void
setSecure(bool flag);
void
setValue(const std::string & newValue);
void
setVersion(int v);

Public Operators

Cookie &
operator=(const Cookie & second);


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.