Using WebDAV with EditLive! for Java

Introduction

Ephox EditLive! for Java supports the WebDAV protocol to enable directory browsing when adding images or hyperlinks to a document.  This provides the end users of EditLive! for Java with an interface to easily browse directories on the server.  However, through the use of EditLive! for Java's XML configuration users can also be restricted in their access so that only specific WebDAV repositories are available to them.

This document provides information on how to use WebDAV with EditLive! for Java.  It assumes that you have a WebDAV enabled server and are able to configure your server to allow WebDAV access to specific directories.

Using WebDAV with Images in EditLive! for Java

When using a WebDAV server with an instance of EditLive! for Java that has been configured accordingly results in users being able to browse the relevant WebDAV repository from within the Insert Image and Insert Hyperlink dialogs in EditLive! for Java.  In the case of the Insert Image dialog EditLive! for Java filters the available files on the WebDAV repository according to their MIME type.  This dialog will only include files which have the image/jpeg, image/gif or image/png MIME types.

Configuring EditLive! for Java for Use with WebDAV

EditLive! for Java can be easily configured for use with WebDAV via the EditLive! for Java XML configuration file.  The configuration settings for the use of WebDAV with EditLive! for Java can be found within the <webdav> element of the EditLive! for Java XML file.  The <webdav> element contains a listing of WebDAV repositories which have their details specified by the <repository> elements.  For more information on these elements please see the EditLive! for Java XML Configuration Guide.

In order to use WebDAV with EditLive! for Java then the WebDAV property or attribute of your chosen EditLive! for Java API must be set to true.  For more information on this property or attribute please consult your EditLive! for Java API.

Basic Configuration Example

The following provides a basic example of how to configure an instance of EditLive! for Java for use with a WebDAV repository.  It involves the minimum number of settings to get WebDAV functioning correctly within EditLive! for Java.  The server does not implement password protection.  For the purposes of this example the WebDAV server which EditLive! for Java is being configured for use with has the following properties:

The XML configuration for EditLive! for Java, in this case, would be:

<editLiveForJava>
    ...
    <webdav>
        <repository name="Images" baseDir="http://www.yourserver.com/UserFiles/WebDAV" webDAVBaseURL="../WebDAV" />
    </webdav>
</editLiveForJava>

Setting a Default Browsing Directory

If, you want the end users of EditLive! for Java to view a directory other than the root directory of the WebDAV repository by default then the defaultDir attribute of the <repository> element should be used and assigned the relevant value.  Users can still move up the directory tree to the root directory if desired.

Continuing from the example above, if the http://www.yourserver.com/UserFiles/WebDAV directory had a subdirectory images which you wished the users of EditLive! for Java to access by default then the XML configuration for EditLive! for Java would be as follows:

<editLiveForJava>
    ...
    <mediaSettings>
        <images>
            <webdav>
                <repository name="Images" 
                    baseDir="http://www.yourserver.com/UserFiles/WebDAV"
                    webDAVBaseURL="../WebDAV"
                    defaultDir="images" />
            </webdav>
        </images>
    </mediaSettings>
    ...
</editLiveForJava>

MIME Type Filtering with WebDAV 

The browsing of a WebDAV repository with EditLive! for Java can be restricted according to the MIME of the files within the repository.  As the WebDAV functionality within EditLive! for Java is used with images then files with the following MIME types will be displayed: 

In order to activate MIME type filtering within EditLive! for Java the EditLive! for Java XML configuration file must contain the relevant setting.  Continuing from the examples above the XML configuration for EditLive! for Java would be as follows:

<editLiveForJava>
    ...
    <mediaSettings>
        <images>
            <webdav>
                <repository name="Images" 
                    baseDir="http://www.yourserver.com/UserFiles/WebDAV"
                    webDAVBaseURL="../WebDAV"
                    defaultDir="images" 
                    useMimeType="true"/>
            </webdav>
        </images>
    </mediaSettings>
    ...
</editLiveForJava>

Note: The default setting for the useMimeType attribute is true.

Password Protected WebDAV Repositories

If your WebDAV repository implements basic authentication then you can configure EditLive! for Java to use the correct username and password information.  In order to do this the <realm> element should be used and assigned the relevant values for the realm, username and password for the WebDAV repository concerned.  If the username and password specified are incorrect, EditLive! for Java will prompt the user for a user for a username and password when the WebDAV server is accessed.

EditLive! for Java supports the following forms of authentication:

Continuing from the examples above the realm was www.yourserver.com (an NTLM realm), and if the username was webdav and the corrosponding password was example then the XML configuration for EditLive! for Java would be as follows:

<editLiveForJava>
    ...
    <authentication>
        <realm realm="www.yourserver.com" username="webdav" password="example" />
    </authentication>
    ...
    <mediaSettings>
        <images>
            <webdav>
                <repository name="Images" 
                    baseDir="http://www.yourserver.com/UserFiles/WebDAV" 
                    webDAVBaseURL="../WebDAV"
                    defaultDir="images"
                    useMimeType="true" 
                    />
            </webdav>
        </images>
    </mediaSettings>
    ...
</editLiveForJava>

Summary

EditLive! for Java can easily be configured to work with WebDAV repositories which exist on your Web server.  The configuration of EditLive! for Java for use with WebDAV affects end users when using the Insert Hyperlink and Insert Image dialogs.  In these dialogs the configuration of EditLive! for Java in this manner allows the end users to browse the server for files to link to, in the case of the Insert Hyperlink dialog, and, in the case of the Insert Image dialog, images which may be inserted.

EditLive! for Java can be configured for use with WebDAV through the  <webdav> and <repository> XML elements.  EditLive! for Java can be configured, through the <realm> XML element, to access WebDAV servers which are password protected or can be left to prompt users for a username and password.

See Also