2011/11/26 Benson Margulies <bimargul...@gmail.com>:
> I'm fairly certain that I know the answer to the question here, but I
> want to pose it just in case I've missed something.
>
> In a web application, I'd like to store a bit of data without
> configuring a database, or, indeed anything that has to be edited into
> an XML file or typed into a container-level gui. As far as I know, the
> entire servlet/webapp spec has nothing for me here, since the Snoracle
> thinking was that this sort of thing was the job of JEE descriptors.
>
> Have I missed something all these years?
>

Define "store". What is proposed lifetime of that information?

You can store anything in memory, using static variables (as each
webapp has its own class loader), or even use
ServletContext.setAttribute().

There are writable directories:
 (a) application-specific one that is cleared on redeployments
(work/appname in Tomcat),
 (b) java.io.tmpdir as well as user home directory.

(a) is required by Servlet spec and there is standard ServletContext
attribute that provides path of that directory. See
ServletContext.TEMPDIR constant.

> Snoracle thinking

JCP was community effort...


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to