为 Tomcat 启用目录列表
Enabling dir listing for Tomcat
这种在 Tomcat 上启用共享目录列表的正确方法是否正确:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>MyProject</display-name>
<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>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
包含web.xml的项目名称是MyProject。我在 Tomcat 上还有其他项目 运行,其中目录列表已关闭。这可行,但我不确定以这种方式覆盖 org.apache.catalina.servlets.DefaultServlet
是否正确?
Tomcat 文档提到此 here 关于覆盖 DefaultServlet
-
You can override DefaultServlet with you own implementation and use
that in your web.xml declaration
很明显,只要适合您的用例,它就会被覆盖,对于目录列表来说,覆盖似乎绝对没问题。
这种在 Tomcat 上启用共享目录列表的正确方法是否正确:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>MyProject</display-name>
<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>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
包含web.xml的项目名称是MyProject。我在 Tomcat 上还有其他项目 运行,其中目录列表已关闭。这可行,但我不确定以这种方式覆盖 org.apache.catalina.servlets.DefaultServlet
是否正确?
Tomcat 文档提到此 here 关于覆盖 DefaultServlet
-
You can override DefaultServlet with you own implementation and use that in your web.xml declaration
很明显,只要适合您的用例,它就会被覆盖,对于目录列表来说,覆盖似乎绝对没问题。