tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: Wanted: directory for persistent file storage for webapp
Date Tue, 30 May 2000 01:09:54 GMT
guru@edamame.stinky.com wrote:

> Thanks for your replies. I figured as much, just thought I'd ask in
> case there was something I was missing.
>
> On Wed, May 24, 2000 at 04:23:27PM -0700, Craig R. McClanahan wrote:
> > guru@edamame.stinky.com wrote:
> >
> > > Let's say I have a guest log servlet. Users can come in and write
> > > messages; the messages get saved to a file; the servlet loads in the
> > > file and displays the content inside itself.
> > >
> > > Easy, right?
> > >
> > > But... WHERE DO I STORE THE FILE?
> > >
> >
> > The standard answer to persistent storage is "use databases, or directory
> > servers, or EJBs for stuff like that."
> >
>
> Yeah, I know... Too bad. I don't like databases. I mean, they're great
> for what they are, they're just overused. It's an extra...
>
>  - machine to buy (for a good RDBMS like Oracle)
>  - process that you have to make sure is running (for a smaller RDBMS like MySQL)
>  - language to learn (SQL / PLSQL / etc.)
>  - log file to read
>  - employee to hire (DBA)
>

There are also several pure-Java databases that can go in the same JVM as the servlet
container.  You don't *have* to have any of the above to use databases.

>
> A filesystem is sufficient for 90% of tasks that people use databases
> for these days. It's fast, it's simple, it's well understood, and it
> never goes down (if the web server is running, so is its hard drive).
>
> See my article at
> http://www.javaworld.com/javaworld/jw-03-2000/jw-0331-ssj-jspxml.html
> for more blatant opinion on the topic.
>
> > If you really want to use disk files (stubborn, aren't we :-), the
> > best approach is to use an initialization parameter in the
> > deployment descriptor to tell you where the persistent directory is.
>
> Yup, but that's not platform-independent. I mean, it limits the
> effectiveness of "plug-and-play" WAR-file webapps.
>

That's why your app should include a tool to customize the deployment descriptor for
a particular install.

>
> > The servlet context does provide
> > you a context attribute with a work directory
> > ("javax.servlet.context.tempdir"), but that is primarily for temporary use --
> > there are no guarantees of persistence.
>
> Oh yeah, thanks.  It'd be nice if there were a ".persdir" attribute as
> well. How do I submit a request like that to the servlet spec committee?
>

The front of the servlet spec (like most (all?) the others) has an appropriate email
address for comments.  In this case, it is:

    servletapi-feedback@eng.sun.com

Note that there is no guarantee that there even is such a thing as a filesystem
accessible to the servlet container, so at best you would have to make the
availability of a persistent storage directory an optional feature.  To say nothing
of the fact that there are security issues with storing potentially sensitive data in
"plain old disk files".

>
>  - Alex
>

Craig McClanahan



Mime
View raw message