Class WebdavServlet

java.lang.Object
All Implemented Interfaces:
Servlet, ServletConfig, Serializable, PeriodicEventListener

public class WebdavServlet extends DefaultServlet implements PeriodicEventListener
Servlet which adds support for WebDAV level 3. 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

The Servlet provides support for arbitrary dead properties on all resources (dead properties are properties whose values are not protected by the server, such as the content length of a resource). By default the Servlet will use non persistent memory storage for them. Persistence can be achieved by implementing the PropertyStore interface and configuring the Servlet to use that store. The propertyStore init-param allows configuring the classname of the store to use, while the parameters in the form of store.xxx will be set on the store object as bean properties. For example, this would configure a store with class com.MyPropertyStore, and set its field myName to value myValue:

  <init-param>
    <param-name>propertyStore</param-name>
    <param-value>com.MyPropertyStore</param-value>
  </init-param>
  <init-param>
    <param-name>store.myName</param-name>
    <param-value>myValue</param-value>
  </init-param>
 

See Also: