What will you query ? To query for something, you must have a reference.
Otherwise, when the client comes back you won't know it already came before.
The server won'r recognize it. This is what the id is for. If the client is
unidentified, there is no mean to know which session belongs to him. You can
desing other ways to indentify the client. You can use it's IP adress if you
know that it is a permanent one. But must clients have not permanetn IPs.
And even in that case, you might want to identify the user and not the
client. Cookies identify clients, ie for example browsers. If you have
Netscape and IE on your computer, and if you open a session based on cookies
with Netscape, the server won't identify you if you come back with your IE
browser.
There are other solutions than cookies :
url rewriting : the main advantage is that you can store the url as a link.
You can then access this link with any brother and the session ID (or the
session data if you choose this solution) will be sent to the server. For
example, if you play chess with a server at the office, you can email the
link to you home email adress and continue to play at home.
user provided id : just display a form and ask the user it's session id.
It's as simple as this. (Of course, you must have sent this ID before to teh
user, And he pust have store is smewher, for exemple on a piece of paper !)
There is no magic in sessions. There is a very little magic in what we use
to call "Java sessions" : with Java sessions, Java will automatically choose
between cookies and url rewriting, provided that you do not forget to encode
urls. You also won't have to deal with a hash table. And you won't have to
deal with invalidating session (provided the default session lifetime is ok
for you). Plus, you will benefit from automatic notification when session
are invalidated.
But you can do all this without using Java sessions. (In fact, every
programmer should do it at least once. After that, he can really enjoy the
power of Java sessions, and he can better appreciate their limitations.)
If you need more information about sessions, jsut ask Mark. He will tell you
on what page of Jason's book to look. (Hi, Mark ;-)
Pierre-Yves
-----Message d'origine-----
De : A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]De la part de
K.S.SREEDHAR KUMAR
Envoyé : mercredi 25 avril 2001 06:44
À : [EMAIL PROTECTED]
Objet : Re: Session Time out
instead of cookie we can store the info on the server itself no!
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 25, 2001 6:50 AM
To: [EMAIL PROTECTED]
Subject: Re: Session Time out
>>> "Basuki, Rendra" <[EMAIL PROTECTED]> 25-Apr-01 1:44:56 AM >>>
>I can use cookie to remeber the user entrance, but
>cookie can be disabled. So, any idea how to solve
>my problem?
String ref=request.getHeader("referrer");
response.sendRedirect(ref);
Not a very clean thing to do though.
Nic Ferrier
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html