>>> "Godbey, David" <[EMAIL PROTECTED]> 12-Jul-00 8:44:03 PM
>>>
>A colleague of mine objects to using session objects to
>stash information because he claims it bloats the servlet
>environment. He prefers, instead, to stash the info in the
>cookie.
>What is the conventional wisdom on this?
That your friend is completly wrong.
1. cookies transfer the data they carray between server and client
Therefore anything you put in the cookie will cross the network many
times. Bandwidth is a lot more valuable than disc-space/memory and
that is the first reason why one uses cookies.
2. cookies can only contain string data
You cannot represent a JDBC Connection or a JavaMail IMAP store
reference as a value that will go into a cookie.
3. cookies have extra overhead
Every cookie needs info like the cookie name and expiry data. A
session object needs just a handle. Cookies, when you access them, are
"bloating" the servlet environment too... and with more overhead than
an object on a session.
4. session objects don't bloat
They meerly stick around until you don't want them anymore. If you
don't want a session you can always invalidate it and it (and all the
objects it carries) will go away.
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