struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: [OT] Working with File System
Date Mon, 21 Oct 2002 16:13:35 GMT

On Mon, 21 Oct 2002, Jacob Hookom wrote:

> Date: Mon, 21 Oct 2002 05:45:39 -0500
> From: Jacob Hookom <>
> Reply-To: Struts Users Mailing List <>
> To: 'Struts Users Mailing List' <>
> Subject: [OT] Working with File System
> Hey All,
> If we are storing large amounts of files on the server, is it acceptable
> (performance wise) to be querying directories straight from the file
> system?  I realize Tomcat does this for directory browsing, but I don't
> know if it will scale well enough that I would need to cache the
> results?

Assuming that there is a filesystem at all would make your application
non-portable, because app servers are *not* required to support that mode
of application execution.  For example, Tomcat gives you the option to run
directly from a WAR.

I would suggest using the context-relative path to the resource as the key
to your database lookups.  That way, it will work either inside or outside
a WAR.  If you need metadata about the resource itself (such as the file
size or the last modified date), you can acquire that by using the
ServletContext.getResource() method to get a URL for the resource, and
then using URL.openConnection() to get a URLConnection for it.  From this
you can read the various headers associated with the file.

> My idea is to query the file system and use their hash code as a look up
> in the DB for extra properties as added by the user (description, etc).

There's no general purpose answer to whether you need to cache or not.
The only way to find out is try it.

> Thanks in advance for any information,
> Jacob


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message