Java Reference
In-Depth Information
Recipe #2.1: Examining Cookies
Cookies are used to maintain a state in a web server. A web server can attach a cookie to
a response so that it can identify that browser when the web server sees another request from
this web browser. Cookies will be discussed in much greater detail in Chapter 8, “Handling
Sessions and Cookies”. For now we will simply examine a cookie in the network analyzer.
To see cookies in action, visit a web site that makes use of cookies. The following page,
on the HTTP Recipes site, uses cookies:
http://www.httprecipes.com/1/2/cookies.php
The contents of this page are shown in Figure 2.12.
Figure 2.12: Ready to Create a Cookie
When the page is first accessed, there will be no cookie, so the cookie will show the value
of “Undefined”. When the “Set Cookie” button is clicked, the cookie's value can be set to any
value.
Search WWH ::




Custom Search