Enable listings is "sort of"** a global setting.

Since the default servlet is declared in conf/web.xml - its inherited in *every* webapp. So its config is also inherited. (Bummer)

BUT - if you add a WEB-INF/web.xml to EVERY webapp with the default servlet settings - then you can remove the default servlet config from conf/web.xml and have the default servlet per webapp config.

That means - in docBase="/path_to_some_dir/" --> you need /path_to_some_dir/WEB-INF/web.xml

What I forget is - what happens if you only create /path_to_some_dir/WEB-INF/web.xml and leave conf/web.xml alone. Which of course would be the easiest thing to do.


-Tim

On 2/25/2010 6:22 AM, Ivan Longhi wrote:
hi,
I would like to list the content of a directory outside tomcat root
without enabling the listings parameter in default servlet.

conf/web.xml
------------
     <servlet>
         <servlet-name>default</servlet-name>
         
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
         <init-param>
             <param-name>listings</param-name>
             <param-value>false</param-value>
         </init-param>
     </servlet>
------------

conf/server.xml
------------
.........

       <Host name="localhost"  appBase="webapps"
             unpackWARs="true" autoDeploy="true"
             xmlValidation="false" xmlNamespaceAware="false">

         <Context path="/test" docBase="/path_to_some_dir/">
             <Parameter name="listings" value="true" />
         </Context>

......
------------

if I try to get a file inside the dir it works (
http://localhost:8080/test/some_file.txt ) but if I try to list the
content of the directory ( http://localhost:8080/test/ ) I get 404.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to