WebDAV

(2Q19)


eXist-db ships with a WebDAV interface. WebDAV makes it possible to manage database collections and documents just like directories and files in a file system. You can copy, move, delete, view or edit files with any application supporting the WebDAV protocol, including Windows Explorer, macOS Finder, cadaver, KDE Konqueror, oXygen XML Editor, XML Spy, LibreOffice and many others (see Compatibility below).

In the default configuration the WebDAV server can be accessed via the URLs http://localhost:8080/exist/webdav/db/ and http://localhost:8443/exist/webdav/db/ (since eXist-db 2.0).

Compatibility

The Milton project, on which eXist-db's WebDAV implementation is build, maintains a detailed WebDAV client compatibility list that describes a "Recipe for broad client compatibility." In case of any problems please read this document. Some preliminary points specific to eXist should be kept in mind:

  • For Windows 7 see notes below and the Milton documentation.

  • eXist's Milton based WebDAV interface does currently not support HTTP Digest Authentication.

  • The size of an XML document is presented as a multiple of 4096 bytes, which is eXist's internal pagesize (see conf.xml). The actual size of an XML document stored in the database can not be determined because the size depends on many factors, among which the serialization parameters applied.

The Milton-based WebDAV interface has been successfully tested with: Windows Web Folders (Windows XP/7), AnyClient (cross-platform), macOS Finder, Transmit (macOS), Cyberduck, davfs2 version 1.4.5 (Linux), OxygenXML and LibreOffice.

The following clients are reported to have issues: GVFS (Nautilus) and NetDrive. However, this can change over time!

Clients

Windows Web Folders

Out of the box, Windows has some native support for the WebDAV protocol, but there are some well-known issues. Please consult the following:

  • Be aware that there are multiple versions of WebDAV Microsoft libraries (and different flavors of bugs). See Web Folder Client (MSDAIPP.DLL) Versions and Issues.

  • Windows Vista and Windows 7 both restrict access to WebDAV servers that use Basic HTTP authentication on non-SSL connections. This restriction can be solved by changing a registry key. Read more on MSDN and greenbytes.de. However, SSL connections do bring improved security.

To use WebDAV in Internet explorer:

  • Select File -> Open.

  • Fill in URL, for instance http://localhost:8080/exist/webdav/db/ or https://localhost:8443/exist/webdav/db/.

  • Check Open as Web Folder.

  • Click Ok.

macOS Finder

The eXist-db database can be accessed easily with the macOS Finder using the Go, Connect to Server... menu. Use the eXist-db WebDAV URL http://localhost:8080/exist/webdav/db/.

In some previous MacOS releases, Apple repetitively changed their WebDAV implementation significantly, introducing new bugs and problems. The main issue is that Finder requires exact document sizes reported for PROPFIND where eXist-db by default reports an estimated size as described above.

As a workaround, eXist-db detects the MacOS finder via the "user-agent" HTTP header and switches for PROPFIND into a kind of MacOS compatibility mode, where all XML documents in a collection are serialized to determine the exact sizes of these documents. This is a rather expensive and time consuming operation for large documents and for collections with many documents.

As an alternative it is recommended to use Transmit or Cyberduck instead.

For macOS 10.8 the WebDAV client has become functional (again) in 10.8.2, but still the client does not work perfectly, for instance at bulk operations.

oXygen XML Editor

  • Select File -> Open URL.

  • Fill User and Password.

  • Enter Server URL http://localhost:8080/exist/webdav/db/.

  • Click Browse.

More info on the oXygen product pages.

Note on SSL connections in oXygen: You may encounter an error: "Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target."

In order to avoid this error, you'll need to add the Server certificate to your trusted certificates keystore (more info).

Warning:

When saving a document to the WebDAV server via oXygen, remember to double check that the document's path in the File URL field at the top of the dialog does really contain the URL to which you want to save the document to. It happens too easily that when you click on another folder or resource by mistake, you overwrite the wrong resource.

davfs2

By default, non-XML files (plain text files, images, etc) are working as expected with davfs2. Because eXist-db reports the size of XML documents as a multiple of the internal pagesize, you can list XML files (ls -l) but you cannot view or edit them. The davfs2 logs (syslog/journalctl) contain: Could not read response body: connection was closed by server

In order to access XML files stored in eXist from a mounted directory in a filesystem via dafvs2, have to add the following additional Java parameters when starting eXist:

  • org.exist.webdav.PROPFIND_METHOD_XML_SIZE=EXACT

  • org.exist.webdav.GET_METHOD_XML_SIZE=EXACT

# webdav tweaks for davfs2
wrapper.java.additional.7=-Dorg.exist.webdav.PROPFIND_METHOD_XML_SIZE=EXACT
wrapper.java.additional.8=-Dorg.exist.webdav.GET_METHOD_XML_SIZE=EXACT 

Warning:

NULL and APPROXIMATE values work for Oxygen and Cadaver but only EXACT can be used with davfs2.

You must first uninstall the service before modifying wrapper.conf, for changes to be applied when reinstalling:

  1. Uninstall (with service name eXist-db)

    sudo systemctl stop eXist-db 
    sudo systemctl disable eXist-db 
    sudo systemctl daemon-reload
    sudo systemctl reset-failed
  2. Reinstall and enable

    sudo /opt/eXist-db/tools/yajsw/bin/installDaemon.sh
    sudo systemctl enable eXist-db

Note: Linux

Tested on davfs2 1.4.7 on RHEL7.5 and 1.5.4 on Arch Linux.

KDE Konqueror

Enter an URL like webdav://localhost:8080/exist/webdav/db. Use webdavs:// for WebDAV over SSL.

LibreOffice

For LibreOffice and OpenOffice.org the recommended way for opening documents stored in eXist-db is using the 'native' WebDAV client, as documented in the LibreOffice Help documentation.

Warning:

When using LibreOffice on MacOS, do not write documents to a network share that is mounted via Finder as documented earlier, since this could corrupt your database. The problem has been identified but there is no solution yet. Please use the alternative described in this chapter.

The first step is configuring LibreOffice to use the LibreOffice Open/Save dialogs, instead of the dialogs that are provided by the operating system:

Now it is possible to type an URL in the File, Open dialog. Enter http://localhost:8080/exist/webdav/db/ and provide your login credentials. Now the dialog box shows the content of the database:

Serialization

When retrieving an XML document via the WebDAV interface, the default serialization settings as defined in conf.xml are used. It is however possible to define custom serialization settings specific for the WebDAV interface.

Copy the file extensions/webdav/src/main/resources/webdav.properties into $EXIST_HOME/etc directory and uncomment/modify the parameters. Changes in this file requires a restart of eXist-db.

## XML Serialization options for the WevDAV
## The file is read from $EXIST_HOME/etc
## Be carefull changing the default values !
indent=no
expand-xincludes=no
process-xsl-pi=no
encoding=UTF-8
omit-xml-declaration=no

Notes

From the community we have received feedback that the WebDAV interface is not fully functional when it is accessed via a reverse proxy and a resource's path is altered (aliased) with it.