Hi,

  Based upon your talk I am assuming following:
- You have directory c:\sample-dir which text files and other files.
- You want to make something like http://ADDRESS/sample-dir which displays list
of  files (like online apache browsing).

  Here is the one way you can do it quickly:

(1) Even though your application is not web-app, you still need to make it look
like web-app to tomcat. For that create directory "WEB-INF" inside 
c:\sample-dir.
Now create a web.xml inside WEB-INF as following:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
    version="2.4">
    <servlet>
        <servlet-name>default</servlet-name>
       
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
        <init-param>
            <param-name>debug</param-name>
            <param-value>0</param-value>
        </init-param>
        <init-param>
            <param-name>listings</param-name>
            <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
</web-app>

   I am running Tomcat 5.5 and I copied it from ROOT\WEB-INF\web.xml and I
removed the contents between <web-app ..> and </web-app>. You can refer to your
tomcat installation. Basically all you need is the <web-app> node inside your
web-xml. The <servlet> node is the default one. Make sure you set "listings" to
true so that you can see the files. "listings" flag should be true by default. 
If
it is true, you don't need <servlet> tag at all and <web-app> should be empty.

(2) Now we have our sample-dir as a fake web application. Now we need to create
context for it. There are two ways to do this:

(A) Inside and detail way:
Create the context file having name sample-dir.xml (why? because we want to call
it as http://ADDRESS/samlple-dir. If you want to call it sample, make the
filename sample.xml) ike this:

<Context docBase="c:\sample-dir"
         privileged="true" antiResourceLocking="false" antiJARLocking="false">
</Context>

   Where to put this xml? Depends upon your installation it should be inside
conf. (probably conf\Catalina\localhost\). Just verify it and refer the
documentation. It is very easy to find.

(B) Easy way:
   Use "admin" webapplication of Tomcat to create context. It is very easy and 
it
does above things for you.

(3) Restart the tomcat on safe side and you should get the result on
http://ADDRESS/sample-dir.

   Hope this helps. Let us know how it goes.

Regards,
Dhaval

--- Smitha Murthy Krishna Nagesh <[EMAIL PROTECTED]> wrote:

> I have a directory of text files that is not deployed into the Tomcat 
> server. It has some jsp's but certainly doesn't have the structure of a 
> web application. I need to somehow point Tomcat to this directory so 
> that the Tomcat can display the contents of these text files. Can you 
> please provide pointers on how to do it? Which files need to be modified 
> etc.
> 
> Thanks,
> Smitha
> 
> -- 
> Smitha Murthy Krishna Nagesh
> Software RDE
> Ph: (650) 786-6328
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



        
                
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to