Examples

Here are some sample exchanges which are designed to illustrate the use of cookies.

First Example Transaction Sequence

Client requests a document, and receives in the response:

Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/; expires=Wednesday, 09-Nov-99 23:12:40 GMT 

When client requests a URL in path / on this server, it sends:

Cookie: CUSTOMER=WILE_E_COYOTE 

Client requests a document, and receives in the response:

Set-Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001; path=/ 

When client requests a URL in path / on this server, it sends:

Cookie: CUSTOMER=WILE_E_COYOTE; PART_NUMBER=ROCKET_LAUNCHER_0001 

Client receives:

Set-Cookie: SHIPPING=FEDEX; path=/foo 

When client requests a URL in path / on this server, it sends:

Cookie: CUSTOMER=WILE_E_COYOTE; PART_NUMBER=ROCKET_LAUNCHER_0001 

When client requests a URL in path /foo on this server, it sends:

Cookie: CUSTOMER=WILE_E_COYOTE; PART_NUMBER=ROCKET_LAUNCHER_0001; SHIPPING=FEDEX 

Second Example Transaction Sequence

Assume all mappings from above have been cleared.

Client receives:

Set-Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001; path=/ 

When client requests a URL in path / on this server, it sends:

Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001 

Client receives:

Set-Cookie: PART_NUMBER=RIDING_ROCKET_0023; path=/ammo 

When client requests a URL in path /ammo on this server, it sends:

Cookie: PART_NUMBER=RIDING_ROCKET_0023; PART_NUMBER=ROCKET_LAUNCHER_0001 

NOTE:

There are two name/value pairs named PART_NUMBER due to the inheritance of the / mapping in addition to the /ammo mapping.