OpenCms WebDAV Configuration

The access to OpenCms through WebDAV is realized with an own servlet (the CmsWebdavServlet). A default configuration of this servlet is already entered in the web.xml configuration provided with the OpenCms web application:

<servlet> 
<description>Creates an access to OpenCms through WebDAV.</description>
<servlet-name>OpenCmsWebDavServlet</servlet-name>
<servlet-class>org.opencms.webdav.CmsWebdavServlet</servlet-class>

<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>
<init-param>
<param-name>repository</param-name>
<param-value>standard</param-value>
    </init-param>
</servlet>

There are three parameters which allows you to configure the WebDAV access:

  • listings: If set to true (the default), you could browse to the contents of OpenCms with a Web Browser.
    But this way it is not possible to edit, delete or create resources in OpenCms. Through the Web Browser it is only possible to list and view the resources.
  • readonly: Though permissions set in OpenCms find attention in the WebDAV protocol as well, it is possible to set the access to OpenCms through WebDAV to all users to read only.
  • repository: This parameter usually should not be changed. It defines the repository to use through the WebDAV servlet.
    The default value specifies that the standard repository should be used, which means that you see the resources in OpenCms through this servlet. The complete documentation describes the use of the default repository. See chapter "Configuration of the repositories in the opencms-importexport.xml" to learn more of the repositories in OpenCms.

The second entry in the web.xml file defines the servlet mapping. In other words the url where to get access to the WebDAV servlet:

<servlet-mapping> 
<servlet-name>OpenCmsWebDavServlet</servlet-name>
<url-pattern>/webdav/*</url-pattern>
</servlet-mapping>

As default you will find the WebDAV access by adding "webdav" to the servlet context. If you have OpenCms installed as a web application "opencms" in your web application container (running at port 8080) you can login to the workplace with the following url: http://localhost:8080/opencms/opencms/system/login

Then you will find the WebDAV at this url: http://localhost:8080/opencms/webdav/

Configuration of the repositories in the opencms-importexport.xml

In the configuration file opencms-importexport.xml you can configure the repositories to access the resources in the VFS of OpenCms.

As default there are 2 configurations: "standard" and "extended".

The standard repository mainly adds the correct extensions to the resources in the VFS, before delivering to the client of the repository (in this case this is the WebDAV client).

The extensions are added through the defined "wrappers" used. Additionally the system folder is made visible, so that you have access to the system folder even if you are not in the root site. Another wrapper adds a virtual folder (which does not exists in the VFS of OpenCms) with files containing the properties of the existing resources. Here you can change the properties of the resources. If you save one of these files the content will be taken to fill the properties of the resource.

With filters you are able to restrict which folders and/or files will be visible to the clients using this repository. There can be one or more regular expressions to be included or excluded from being visible.

The name of the repository can then be taken to be used in the web.xml.

Below you find the xml configuration of the standard repository.

<repository name="standard" class="org.opencms.repository.CmsRepository">
<params>
<param name="wrapper">org.opencms.file.wrapper.CmsResourceExtensionWrapperJsp</param>
<param name="wrapper">org.opencms.file.wrapper.CmsResourceExtensionWrapperXmlContent</param>
<param name="wrapper">org.opencms.file.wrapper.CmsResourceExtensionWrapperXmlPage</param>
<param name="wrapper">org.opencms.file.wrapper.CmsResourceWrapperSystemFolder</param>
<param name="wrapper">org.opencms.file.wrapper.CmsResourceWrapperPropertyFile</param>
</params>
<filter type="include">
<regex>/</regex>
<regex>/__properties/.*</regex>
<regex>/sites/.*</regex>
<regex>/system/</regex>
<regex>/system/__properties/.*</regex>
<regex>/system/galleries/.*</regex>
<regex>/system/modules/.*</regex>
<regex>/system/workplace/.*</regex>
</filter>
</repository>

Additional information for removing /opencms/opencms with Apache HTTP server

If you want to remove the "/opencms/opencms" prefix in the url, you have to set up an Apache HTTP Server with an VirtualHost entry in the httpd.conf (see Alkacon Documentation). 
To make the WebDAV access to OpenCms work again after configuring this way, you have to insert the following lines to the VirtualHost entry in your httpd.conf:

ProxyPass         /webdav/                  http://127.0.0.1:8086/webdav/ 
ProxyPass         /webdav                   http://127.0.0.1:8086/webdav/

Replace the server name (127.0.0.1) and the port (8086) with the entries that are correct in your configuration.