codeomnitrix
codeomnitrix

Reputation: 4249

How the session cookie is maintained by browser

Hey all I was trying to create a java program which will remain logged in on server whenever i browse on website no authentication will be required even if i run the program later on i.e. my program should store some cookie file on client side and also tell the browser that this session should lasts for quite a long time. And whenever i run the program this should send the cookie details, that this is recognized and the user is logged on, to the server.

So how this should be done using HTTP protocol.

Thanks. :)

Upvotes: 0

Views: 2202

Answers (2)

Bozho
Bozho

Reputation: 597076

The browser (client) stores a session cookie containing a key-value pair. The key is usually JSESSIONID, and the value is a unique identifier. It is received by the client as a response of his request to the server, which initiates the session.

Whenever a request is made to the server, the browser sends that key-value pair in a special http header ("Cookie"). The server then reads that header, obtains the identifier, and finds the corresponding session.

Upvotes: 3

Alex Abdugafarov
Alex Abdugafarov

Reputation: 6392

Why don't you guys use Google before asking?

See the following:

Upvotes: 2

Related Questions