Mukul Gandhi wrote:
> Hi Craig,
> u said regarding HttpSession object created in doPost() or doGet(). I know
> these facts(Pl correct if I am wrong) -
> 1. If many users are invoking the same servlet, then a Httpsession object
> is created for each user. These session objects for different users are
> existing in various threads(1 thread per servlet invocation) and don,t
> share anything.
Yes, a unique session object is created for each user. Objects you store in a
session for one user are not shared with session objects stored in other sessions
for other users.
No, you cannot assume that this fact *alone* makes you thread-safe, because you
cannot assume that the same user will not trigger more than one request at the
same time (which would be handled by different threads accessing the same session
object).
>
> 2. The Servlet environment identifies the sessions for users by means like
> persistent cookies or url rewwriting mechanisms. If a particular user wants
> to store some java object in his session object, it is done by calling
> session.putValue(String,Object) method.
Yes, this is correct. Of course, there is an obligation on the servlet developer
to cooperate with this mechanism if there is any chance that your users do not
have cookies enabled. You must pass any URL that points back to your site
through the response.encodeURL() method to actually perform the rewriting.
>
> I am reading Jason Hunter's book. Its very well written.
>
I agree ... this book is a tremendous help in understanding how to program for
the servlet environment.
>
> Regards
> --Mukul Gandhi
>
Craig
___________________________________________________________________________
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