On Fri, 15 Nov 2002, Will Glass-Husain wrote:
> Date: Fri, 15 Nov 2002 17:09:46 -0800 (PST) > From: Will Glass-Husain <[EMAIL PROTECTED]> > Reply-To: Tomcat Users List <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Subject: saving application attributes > > > Hi, > > I've noticed that with Tomcat (4.1.12) when I reload a webapp, all > serializable session objects are preserved. This also appears to happen when > I call the shutdown and the startup scripts. > > I've recently moved some data in a webapp from being an attribute of the > session to being an attribute of the application e.g. > getServletContext().setAttribute(key,value) > > Now, if I reload the webapp the data seems to be lost. It's automatically > regenerated by my application but this is time consuming. Is there a way to > also preserve this information similarly to the session attributes? > You can do this for yourself, by using a ServletContextListener. In the contextDestroyed() method, save whatever you want to save. In the contextInitialized() method, recreate the appropriate attributes if they were saved -- for robustness, you'll probably want to just create them from scratch if there was no saved information (i.e. this is the first time you've started up this application). > WILL Craig -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
