Wednesday, September 28, 2005

What is Cookie ? What is its purpose ?

Cookie is nothing more than a little piece of data(a name/value string pair) exchanged between the client and the server. The server sends the cookies to the client, and the client returns the cookie when the client makes another request. Cookie exchange is automatic.

By default cookies stay alive only as long as a session exists; once the client quits his browser, the cookies disappears. That’s how the “JSESSIONID” cookie works.

But we can make a cookie to stay alive even AFTER the browser shuts down. In this way our web application can still get the cookie information even though the session with that client is long gone.

If we set cookies programatically we don’t have to bother whether the user restarted his browser and hasn’t been on the site for a week.

Cookie Purpose: Session Tracking

Http Cookie is the most used session tracking mechanism and is required to be supported by all servlet containers.

Specification dictates that the session tracking cookie must be “JSESSIONID” cookie.

0 Comments:

Post a Comment

<< Home