thanks!!!
this should be the solution (and one more little question at the end of code):
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> <!-- FALSE to avoid
inheritance to all webapps -->
</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>
......
------------
/path_to_some_dir/WEB-INF/web.xml
------------
<web-app ...>
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
------------
is <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
the right solution?
thanks,
ivan
On Thu, Feb 25, 2010 at 1:19 PM, Tim Funk <[email protected]> wrote:
> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
ciao,
ivan
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]