eXo Platform 3.0

- Prev
- Next

## Chapter 30. WebDAV

## Related documents

- Link Producer

## Introduction

The WebDAV protocol allows you to use third party tools to communicate with hierarchical content servers via HTTP. It is possible to add and remove documents or a set of documents from a path on the server. DeltaV is an extension of the WebDav protocol that allows to manage document versioning. Locking guarantees protection against multiple access when writing resources. The ordering support allows to change the position of the resource in the list and sort the directory for the convenience of viewing the directory tree. The full-text search makes it easy to find the necessary documents. You can search by using two languages: SQL and XPATH.

In eXo JCR, we plug in the WebDAV layer - based on the code taken from the extension modules of the reference implementation - on the top of our JCR implementation so that it is possible to browse a workspace using the third party tools (it can be Windows folders or Mac ones as well as a Java WebDAV client such as DAVExplorer or IE using File->Open as a Web Folder).

Now WebDav is an extension of the REST service. To get the WebDav server ready, you must deploy the REST application. Then, you can access any workspaces of your repository by using the following URL:

Standalone mode:

`http://host:port/rest/jcr/{RepositoryName}/{WorkspaceName}/{Path}`

Portal mode:

`http://host:port/portal/rest/private/jcr/{RepositoryName}/{WorkspaceName}/{Path}`

When accessing the WebDAV server - here URL is `http://localhost:8080/rest/jcr/repository/production`, you might also use "collaboration" (instead of "production") which is the default workspace in eXo products - the user will be asked to enter his login and password. Those will then be checked by using the organization service (that can be implemented thanks to an Inmemory(dummy) module or DB module or LDAP one) and the JCR user session will be created with the correct JCR Credentials.

NOTE: If you try the "in ECM" option, add "@ecm" to the user's password. Alternatively, you may modify jaas.conf adding the domain=ecm option like:

    exo-domain {
         org.exoplatform.services.security.jaas.BasicLoginModule required domain=ecm;
    };

## Configuration

    <component>
      <key>org.exoplatform.services.webdav.WebDavServiceImpl</key>
      <type>org.exoplatform.services.webdav.WebDavServiceImpl</type>
      <init-params>

        <!-- this parameter indicates the default login and password values
             used as credentials for accessing the repository -->
        <!-- value-param>
          <name>default-identity</name>
          <value>admin:admin</value>
        </value-param -->

        <!-- this is the value of WWW-Authenticate header -->
        <value-param>
          <name>auth-header</name>
          <value>Basic realm="eXo-Platform Webdav Server 1.6.1"</value>
        </value-param>

        <!-- default node type which is used for the creation of collections -->
        <value-param>
          <name>def-folder-node-type</name>
          <value>nt:folder</value>
        </value-param>

        <!-- default node type which is used for the creation of files -->
        <value-param>
          <name>def-file-node-type</name>
          <value>nt:file</value>
        </value-param>

        <!-- if MimeTypeResolver can't find the required mime type,
             which conforms with the file extension, and the mimeType header is absent
             in the HTTP request header, this parameter is used
             as the default mime type-->
        <value-param>
          <name>def-file-mimetype</name>
          <value>application/octet-stream</value>
        </value-param>

        <!-- This parameter indicates one of the three cases when you update the content of the resource by PUT command.
             In case of "create-version", PUT command creates the new version of the resource if this resource  exists.
             In case of "replace" - if the resource  exists, PUT command updates the content of the resource and  its last modification date.
             In case of "add", the PUT command tries to create the new resource with the same name (if the parent node allows same-name siblings).-->

        <value-param>
          <name>update-policy</name>
          <value>create-version</value>
          <!--value>replace</value -->
          <!-- value>add</value -->
        </value-param>

        <!--
            This parameter determines how service responds to a method that attempts to modify file content.
            In case of "checkout-checkin" value, when a modification request is applied to a checked-in version-controlled resource, the request is  automatically preceded by a checkout and followed by a checkin operation.
            In case of "checkout" value, when a modification request is applied to a checked-in version-controlled resource, the request is automatically preceded by a checkout operation.
        -->
        <value-param>
          <name>auto-version</name>
          <value>checkout-checkin</value>
          <!--value>checkout</value -->
        </value-param>

        <!--
            This parameter is responsible for managing Cache-Control header value which will be returned to the client.
            You can use patterns like "text/*", "image/*" or wildcard to define the type of content.
        -->
        <value-param>
          <name>cache-control</name>
          <value>text/xml,text/html:max-age=3600;image/png,image/jpg:max-age=1800;*/*:no-cache;</value>
        </value-param>

        <!--
            This parameter determines the absolute path to the folder icon file, which is shown
            during WebDAV view of the contents
        -->
        <value-param>
          <name>folder-icon-path</name>
          <value>/absolute/path/to/file</value>
        </value-param>

      </init-params
    </component>

## Screenshots

At present, eXo JCR WebDav server was tested by using MS Internet Explorer, Dav Explorer, Xythos Drive, Microsoft Office 2003 (as client), and Ubuntu Linux.

### MS Internet Explorer

(File -> Open as Web Folder)

### Dav Explorer

### Xythos Drive

### Microsoft Office 2003

(as client) (File->Open with typing http://... href in the file name box)

### Ubuntu Linux

## Comparison table of WebDav and JCR commands

Table 30.1.

WebDav | JCR
--- | ---
COPY | Workspace.copy(...)
DELETE | Node.remove()
GET | Node.getProperty(...); Property.getValue()
HEAD | Node.getProperty(...); Property.getLength()
MKCOL | Node.addNode(...)
MOVE | Session.move(...) or Workspace.move(...)
PROPFIND | Session.getNode(...); Node.getNode(...); Node.getNodes(...); Node.getProperties()
PROPPATCH | Node.setProperty(...); Node.getProperty(...).remove()
PUT | Node.addNode("node","nt:file"); Node.setProperty("jcr:data", "data")
CHECKIN | Node.checkin()
CHECKOUT | Node.checkout()
REPORT | Node.getVersionHistory(); VersionHistory.getAllVersions(); Version.getProperties()
RESTORE | Node.restore(...)
UNCHECKOUT | Node.restore(...)
VERSION-CONTROL | Node.addMixin("mix:versionable")
LOCK | Node.lock(...)
UNLOCK | Node.unlock()
ORDERPATCH | Node.orderBefore(...)
SEARCH | Workspace.getQueryManager(); QueryManager.createQuery(); Query.execute()

## Restrictions

There are some restrictions for webdav in different Operating systems.

### Windows 7

When you try to setup a web folder by “adding a network location” or “map a network drive” through My Computer, you can get an error saying that either “The folder you entered does not appear to be valid. Please choose another” or “Windows cannot access… Check the spelling of the name. Otherwise, there might be…”. These errors appear whether I’m using SSL or non-SSL.

To fix this follow such steps:

1. Go to Windows Registry Editor

2. Find a key: \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlset\services\WebClient\Parameters\BasicAuthLevel

3. Change the value to 2

### Mac OS 10.5.3 and higher

There is a known Finder bug started from Mac OS v.10.5.3 and not yet fixed.

When you upload file to webdav server, the file will appear with 0 kb. size.

For more details follow: Apple Disscussion thread.

- Prev
- Up
- Home
- Next