tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Hencin <>
Subject Re: How to set up a special folder to list all files under it?
Date Tue, 02 Jan 2007 16:32:27 GMT

Hello, I noticed the mention of symbolic links and it was
similar enough to what I did in our application to provide a kind of
"symbolic link" in our application. The method I cam up with allowed
the user to user tomcat, and then also create a directory outside the context
of our web app that is used to store files. We allow users to attach files
within our application that are related to database entries. 

The problem we had was that we wanted to have a location
deliberately outside the context of the web app for two reasons. 1) Redeployment
risked deleting the saved files (they act as an archive and must be saved) 2)
disk location growth. These files can be very large, and we wanted to provide a
way to let the end users easily place them on another volume or disk. So we now
have the users create a virtual directory. We use apache web server. This
virtual directory is linked to the file location. then we have them enter that
virtual directory path into our database, and its served up on the pages. This
then lets the users follow the link to the virtual directory, and apache takes
care of the listings. 

We do not use apache as a front end at all, just in this case
we use its virtual directory feature. Tomcat does a fine enough job of the web
serving we need. but in this once case, where we wanted to show files i a
difference place, not in the context of the web app I came up with this kind of
work around. Before that we just used a UNC path stored in the database, but it
did not work well with firebird and safari, and users outside the network could
not follow the UNC link. 


This method of using a virtual directory from apache (or IIS
) seems to work nicely.

Michael Hencin
President - Enginuity Development Inc.
P: 815-301-9939
F: 815-301-2007

----- Original Message ----
From: "Caldarale, Charles R" <>
To: Tomcat Users List <>
Sent: Monday, January 1, 2007 12:48:16 AM
Subject: RE: How to set up a special folder to list all files under it?

> From: kkus [] 
> Subject: How to set up a special folder to list all files under it?
> Now I need add a specific folder which will let user to browse
> all files under it without authentication.

I haven't personally tried the following, so take it with a grain of
salt.  Also, others might know an easier way to accomplish what you

Delivery of static content and directory listings is under control of
the default servlet, as defined in the conf/web.xml file.  By default,
this has the listings param set to false, to disable ad hoc browsing.  I
think you could copy the config for the default servlet, change
<servlet-name> from default to something appropriate for your purpose,
set the listings param to true, and add a servlet mapping for this
renamed default to use a <url-pattern> pointing to the directory you
want to store your public files in.  You would want to put this
redefined servlet definition and mapping in the WEB-INF/web.xml of the
webapp that will hold the public directory.

 - Chuck

MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message