Class WebdavServlet

All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public class WebdavServlet extends DefaultServlet
Servlet which adds support for WebDAV level 2. All the basic HTTP requests are handled by the DefaultServlet. The WebDAVServlet must not be used as the default servlet (ie mapped to '/') as it will not work in this configuration.

Mapping a subpath (e.g. /webdav/* to this servlet has the effect of re-mounting the entire web application under that sub-path, with WebDAV access to all the resources. The WEB-INF and META-INF directories are protected in this re-mounted resource tree.

To enable WebDAV for a context 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>false</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>webdav</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>
 
This will enable read only access. 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>
 
Don't forget to secure access appropriately to the editing URLs, especially if allowSpecialPaths is used. With the mapping configuration above, the context will be accessible to normal users as before. Those users with the necessary access will be able to edit content available via http://host:port/context/content using http://host:port/context/webdavedit/content
Author:
Remy Maucherat
See Also: