tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: retrieving two different objects from session (should be thesame)
Date Thu, 08 May 2008 15:51:28 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

Caldarale, Charles R wrote:
|> From: Christopher Schultz [mailto:chris@christopherschultz.net]
|> Subject: Re: retrieving two different objects from session
|> (should be thesame)
|>
|> My tenuous understanding of session handling in Tomcat
|> is that HttpServletRequest.getSession roughly returns:
|>
|> new StandardSessionFacade(theRealSessionObject)
|
| Don't think so.  I just took a look at the code, and it appears to me
| that the facade is only created once per session, not once per
| getSession() call.

Okay. I was looking around for that before I sent my message, but I
started to get lost in the Request versus Request versus StandardRequest
versus HttpSevrletRequest versus whatever else is in there.

| I did think of another issue with this situation:  if the attribute
| under discussion is only relevant for one particular request, it's a
| design flaw to store it in the session.

Definitely.

| It should be saved in the
| request instead, thereby avoiding any concurrency issues.  Since the OP
| didn't really give us much information about the lifetime of the
| attribute, I just assumed it had session scope.

Yeah. I'm wondering if he's using some type of form processing library
that re-writes the "form" object in the session each time. Struts, for
example, allows you to define forms for processing to have "session"
scope, and it will create the object and stuff it into the session for
you. There's no guarantee that the form object itself will survive
multiple requests, though the form should always be available. It's
possible that a new object would be created and actually replace the
in-session object, though I don't think that's actually how it's
implemented.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgjIYAACgkQ9CaO5/Lv0PCNWQCffAxYIqwob9qA6NfyItOq+Jwm
CNkAoKWbvtxoyJLZF7sD602CHltbq802
=ZA/o
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message