Howdy, ThreadLocal is risky. This is the type of situation where the servlet 2.4 request listeners might be useful: you'd create you session-like object when the request is initialized, use it etc, and then destroy it when the request is done. That object would be a Map-type structure, decoupled from the servlet API ;)
Yoav Shapira Millennium ChemInformatics >-----Original Message----- >From: Christopher Schultz [mailto:[EMAIL PROTECTED] >Sent: Thursday, October 30, 2003 7:55 AM >To: Tomcat Users List >Subject: Re: ThreadLocal relationship to servlet requets and use to store >variables > >JiJi, > > Unfortunately, the corporate architects do not allow >> presentation tier (ie: servlet requests) to be passed all the way down >> to the persistence tier. > >This is a good policy. Your persistence should have nothing to do with >your presentation. > >> The goal is to put the session pull the login >> id out of the servlet session, on each request, and stick it in an >> application defined session object instance that is uncoupled from the >> servlet api's. > >Why not pass that application-session object to your "session"-based >services, instead of playing tricks with ThreadLocal. > >> Putting the Session instance into thread local would, I >> hope, make it available to the persistence tier without adding a method >> parameter all the way through all method calls top to bottom. > >Yes, ThreadLocal will do that, but it's very messy, pretty much >impossible to document, and probably just not the right thing to do. > >You don't necessarily need to add parameters all the way down the call >tree. Did you guys design a persistence layer with methods that take no >arguments? That sounds weird... why can you not use the intended methods >in your persistence layer? > >-chris > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
