Monday, March 30, 2009

Directory Mapping in Tomcat 6 / 5.5

For those of u who have always wanted to map a directory and not a servlet in Tomcat, here is how to do it:
1. First in your web.xml - edit the < listings > tag as follows:
< init-param >
< param-name > listings < / param-name >
< param-value > true < / param-value >
< / init-param >


2. Then ensure that under the conf folder in your Tomcat directory, you have the following virtual directory (for Tomcat 6):
conf -> Catalina -> localhost

The above directories will already exist in Tocat 5.5, so all you need to do i carry on Step 3.

3. create a file called media.xml and save it in the localhost folder. Also, put the following content into this folder:

< !--
Context configuration file for the Tomcat Manager Web App
$Id: resources.xml 303123 2004-08-26 17:03:35z remm $
-- >

< Context path="/media" docBase="D:/Importer/Media" debug="0" privileged="true" >
< / Context >


With this media.xml file, if you type in http://localhost/media, it will get mapped to the D:/Importer/Media
Setting the < listings > tag causes the directory structure within D:/Importer/Media to be displayed.

1 comment:

Thank you for your comment.