Configure a WebDAV folder using Tomcat 6
Tomcat 6 comes prebundled with a WebDAV servlet. To enable the servlet, add the following to web.xml
<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> <!-- The following for read-write access --> <init-param> <param-name>readonly</param-name> <param-value>false</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>webdav</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping>
To provide security for WebDAV using Tomcat realms, add the following to web.xml
<security-constraint> <web-resource-collection> <web-resource-name>webdavapp</web-resource-name> <url-pattern>/*</url-pattern> <http-method>PROPFIND</http-method> <http-method>PROPPATCH</http-method> <http-method>COPY</http-method> <http-method>MOVE</http-method> <http-method>LOCK</http-method> <http-method>UNLOCK</http-method> </web-resource-collection> <auth-constraint> <role-name>*</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>BASIC</auth-method> <realm-name>webdavapp</realm-name> </login-config> <security-role> <description>WebDAV User</description> <role-name>webdav</role-name> </security-role>
and add a new role and user to conf/tomcat-users.xml:
<role rolename="webdav"/> <user username="webdavuser" password="password" roles="webdav"/>