Tomcat6配置webdav协议

时间:2022-12-05 19:14:37

Tomcat6默认是支持webdav协议的,只是webapps目录中不带例子而已。要添加支持很简单,在webapps目录中建立webdav目录,在webdav目录中建立WEB-INF目录,加入web.xml文件即可,其内容如下: 

<?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: 

  <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: 

  <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 add

  <init-param>
<param-name>allowSpecialPaths</param-name>
<param-value>true</param-value>
</init-param>