Tomcat6默認是支持webdav協議的,只是webapps目錄中不帶例子而已。要添加支持很簡單,在webapps目錄中創建webdav目錄,在webdav目錄中創建WEB-INF目錄,加入web.xml文件便可,其內容以下: html
<?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <servlet> <servlet-name>webdav</servlet-name> <servlet-class>org.apache.catalina.servlets.WebdavServlet</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> <init-param> <param-name>readonly</param-name> <param-value>false</param-value> </init-param> <!--load-on-startup>1</load-on-startup--> </servlet> <servlet-mapping> <servlet-name>webdav</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> </web-app>
To enable read-write access add: java
<init-param> <param-name>readonly</param-name> <param-value>false</param-value> </init-param>
To make the content editable via a different URL, use the following mapping: web
<servlet-mapping> <servlet-name>webdav</servlet-name> <url-pattern>/webdavedit/*</url-pattern> </servlet-mapping>
By default access to /WEB-INF and META-INF are not available via WebDAV. To enable access to these URLs, use addapache
<init-param> <param-name>allowSpecialPaths</param-name> <param-value>true</param-value> </init-param>