tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: Writing files from a class
Date Wed, 14 Aug 2002 15:37:12 GMT
Hi,

>I see that the spec mentions "private temporary directory" - I need a
>permananent directory - by temporary I take it to mean that I can't
>count on the files "sticking around". Is my understanding here flawed?

Your understanding as far as a temporary directory is correct.  If you
need a permanent directory, you can:

- Specify one as a parameter (resource-ref, init-param to a servlet,
context-param etc.).

- Use another storage medium, e.g. a database.

>Also, I'd like to be able to specify the name and location.
>I had seen the javax.servlet.ServletContext.log() methods, but they
seem
>to offer no control over where the output is placed. I'd rather have a
>debug file per class than have all messages sent to a single file.

I'm sorry, I don't have your original message in front of me.  Are you
using a logging solution e.g. log4j or commons-logging, or are you
constricted to relying only on the ServletContext.log() methods?  Log4j
etc will let you configure the log files to whatever detail level you
want, including path and separate log files per class.

>And finally, I have servlets that take data from a db and place it in a
>(text) file for the user to download - so once again a file creation
>issue where I need a general file i/o solution.

Why can't you use the temporary directory for this?  Unless you want to
files to persist across server restarts, in which case you would either
put them in a DB or tell your servlets what directory to use via the
param methods mentioned above.

Yoav Shapira
Millennium ChemInformatics

Mime
View raw message