This example shows how to get a cookie value and how set a cookie value. The cookie value will be empty on the first request because no cookie has been set. After the first request, request.getcookie will return the value that was set by response.setcookie if the cookie has not yet expired.