At the moment I have listings enabled(see code below) which means everyfolder is affected. how can i make it so that only webapps/myProject/myFolder is listable?
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
I have looked at this document but i do not understand it. can someone help please.
edit: my local web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"[]>
<web-app id="WebApp_ID">
<display-name>Project1</display-name>
<description>Project1</description>
<context-param>
<param-name>EnableSessionPersistency</param-name>
<param-value>False</param-value>
</context-param>
<context-param>
<param-name>DataDirectory</param-name>
<param-value>App_Data</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.faces.application.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.aspx</param-value>
</context-param>
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
<listener>
<listener-class>Mainsoft.Web.SessionState.SessionListener</listener-class>
</listener>
<servlet>
<servlet-name>VmwIncludeHelperServlet</servlet-name>
<servlet-class>Mainsoft.Web.Hosting.IncludeHelperServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>VmwDynamicServlet</servlet-name>
<servlet-class>GhDynamicHttpServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>XmlDynamicServlet</servlet-name>
<servlet-class>XmlContentTypeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>XmlDynamicServlet</servlet-name>
<url-pattern>/rdTemplate/rdAjax/rdAjax.aspx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>/aspnetconfig</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>/aspnetconfig/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>/assemblies/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.mdf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.lck</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.properties</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.dat</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.ctrl</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.aspx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.asmx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.ashx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.invoke</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.soap</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.rem</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.axd</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.master</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.resource</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.skin</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.browser</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.sitemap</url-pattern>
</servlet-mapping>
<s开发者_运维百科ervlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.webinfo</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.resx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.asax</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.ascx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.config</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.Config</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.cs</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.vb</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.csproj</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.vbproj</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.licx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.dll</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwIncludeHelperServlet</servlet-name>
<url-pattern>/servletincludehelper</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>20</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>Default.aspx</welcome-file>
</welcome-file-list>
</web-app>
Instead of modifying the web.xml
under $CATALINA_BASE/conf/web.xml
, put the below configuration in your local web.xml
.
<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>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
...
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/path/to/listabledir</url-pattern>
</servlet-mapping>
The key here is the line <url-pattern>/path/to/listabledir</url-pattern>
.
The Tomcat Wiki should give you some reference.
精彩评论