Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 32980 invoked from network); 1 Aug 2002 20:33:55 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 1 Aug 2002 20:33:55 -0000 Received: (qmail 5216 invoked by uid 97); 1 Aug 2002 20:33:53 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 5184 invoked by uid 97); 1 Aug 2002 20:33:52 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 5172 invoked by uid 98); 1 Aug 2002 20:33:51 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Subject: Re: howto avoid overuse of session object? To: "Tomcat Users List" X-Mailer: Lotus Notes Release 5.0.5 September 22, 2000 Message-ID: From: jeff.guttadauro@abbott.com Date: Thu, 1 Aug 2002 15:32:48 -0500 X-MIMETrack: Serialize by Router on ABTAPN55/ESVR/ABBOTT(Release 5.0.5 |September 22, 2000) at 08/01/2002 03:30:05 PM MIME-Version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: quoted-printable X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Thanks, C=E9dric and Peter Lin, for your responses=2E Both of you seem= to be saying that, instead of storing large objects in the session object, I = should be storing them in the application object (ServletContext)=2E I find t= his to be rather confusing=2E It seems like the overhead involved in storing thi= ngs in the application object would be much greater than storing things in the= session object=2E At least the session objects would eventually die wh= en sessions time out or they are invalidated by the web app, and the space= they were using could then be garbage collected=2E But the application obje= cts would live as long as the server is up, and I would think would eventually co= nsume memory moreso than using the session would=2E Also, there would be a e= xtra level of complexity involved with maintaining the association between t= he objects in the application object and their respective sessions=2E Am = I unclear on the concept, or is there something else that I'm not understanding? Thanks, -Jeff = =20 C=E9dric Viaud = =20 =20 si-tls=2Efr> cc: = =20 Subject: Re: howto a= void overuse of session object? =20 08/01/02 11:30 AM = =20 Please respond to = =20 "Tomcat Users List" = =20 = =20 = =20 Hi, FIRST For non-specific Tomcat questions, it exists : SERVLET-INTEREST@JAVA=2ESUN=2ECOM There's also an other one wich is JSP oriented=2E SECOND All best practice i know says that you must minimize the ammount of dat= a stored in the session=2E So, the traditional approach of this problem i= s to only store the user-id (simple type) in the session=2E All over session= informations (a class containing all required informations) are stored = in the servlet context=2E Praticaly, on the request you get the user id from the user session=2E = Next you use this Id to get the "user information obect" from the servlet context=2E This is certainly deceiving, but this is the way =2E=2E=2E Maybe someone knows better practice ? Regards, C=E9dric ----- Original Message ----- From: To: Sent: Thursday, August 01, 2002 6:13 PM Subject: OT: howto avoid overuse of session object? > This is sort of off-topic, but I don't know of a better forum targeti= ng Java > web/servlet programming=2E If anyone does know of one, could you let= me know? > > I'm basically wondering if others have found effective ways to avoid = the > tempting but bad practice of loading up the session with all sorts of= > attributes=2E I often find myself needing some Bean or other object = for maybe 2 > or 3 requests, and, rack my brains as I may for an elegant way of pas= sing the > object along without putting it in the session, I usually end up with= nothing > more than a headache and 1 more attribute in my session=2E :( I'm developing > with an MVC approach, with Struts for more recently developed apps an= d a > similar custom framework for our older apps, but I just can't seem to= see a > way to get around this problem=2E I would love it if there were an o= bject like > a thisRequestAndTheNextOne object, where attributes would stick aroun= d for the > current request and subsequent request, and then the controller could= get > objects from the previous request and determine if it should put them= in the > new thisRequestAndTheNextOne object for the current request=2E I don= 't know if > that makes sense to anyone else, but, nevertheless, does anyone have = any ideas > to do what I'm trying to do? > > Does anyone else feel my pain? ;) > > Thanks, > -Jeff > > > -- > To unsubscribe, e-mail: > For additional commands, e-mail: > -- To unsubscribe, e-mail: For additional commands, e-mail: = -- To unsubscribe, e-mail: For additional commands, e-mail: