I think the original poster was talking about using
javax.servlet.http.Cookie to store state information inside the cookies
and then transfer  back to client brower, e.g.

Cookie cookie = new Cookie("book1","Servlet Programming");
res.addCookie(cookie);

This cookie could be stored persistently on the client's machine if he
sets the expiry time larger than 0. (negative means delete the cookie
when browser closes, 0 means delete cookie instantly).

cookie.setMaxAge(3000);

Even he elects to use cookies himself (vs. servlet engine uses cookies
to store session id), to reduce network bandwidth, he should only send
back cookies containing "session id" to client. Other state information
could be stored at server end, say hash table keyed with session id.

Cookie cookie = new Cookie("sessionid",generateSomeUnigueID);
res.addCookie(cookie);

Bing


-----Original Message-----
From: Milt Epstein
To: [EMAIL PROTECTED]
Sent: 8/31/00 1:14 PM
Subject: Re: Session Tracking and Cookie

On Thu, 31 Aug 2000, Vivek Singh wrote:

> Then should i consider that when we use Session Tracking the session
> information (SI) at client end is in browser and when u go for
> cookie the SI is in persistent storage.........other than that there
> is no difference.

I don't think I'm following you -- like what you mean by "persistent
storage".

In any case, all the session information is stored on the server.
There just needs to be something in the request that allows the server
to pull up the correct session, and that is the session ID.  That can
be done either by keeping the session ID in a cookie, or in the URL
using URL Rewriting (someone else mentioned that in another response
to your post).  (At least, those are the built-in mechanisms the API
provides.)

If you use a cookie, the cookie is not stored persistently on the
client end, but goes away when the browser is exited.  (At least, the
newer versions of the spec say this; I don't think older ones covered
it, so the behavior was left up to the servlet engine developer).


> -----Original Message-----
> From: Milt Epstein [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 31, 2000 5:31 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Session Tracking and Cookie
>
>
> On Thu, 31 Aug 2000, Vivek Singh wrote:
>
> > In session tracking all the session information is with the server
> > only and just an ID is sent to the client (browser e.g.). In cookies
> > the whole of session information is kept with the browser on the
> > persistent store. So when u use cookies network traffic is higher
>
> I don't believe this is correct.  When you use cookies for sessions,
> only the session ID is stored/passed in the cookie.  I don't think it
> will make much of a difference network traffic wise.
>
> > and in case of servlet session tracking more data has to be stored
> > on server. There are cases when u cannot assume that cookies are
> > enabled on browser. OK. That means when cookies are disabled even
> > then i can use Servlet Session Tracking? Why should i go for cookie?
> > Can it be so that browser dont support Servlet Session Tracking i.e.
> > not keeping the Session ID with them.  Hope i am clear.
>
> Milt Epstein
> Research Programmer
> Software/Systems Development Group
> Computing and Communications Services Office (CCSO)
> University of Illinois at Urbana-Champaign (UIUC)
> [EMAIL PROTECTED]
>
>
________________________________________________________________________
___
> 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
>

Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]

________________________________________________________________________
___
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

Reply via email to