WebDAV Construction Kit

(work in progress)

The WebDAV Construction Kit (WCK) was created by Oliver Zeigermann in response to Slide being too difficult to use. It is perfect for giving a generic application basic WebDAV functionality with both ease of use and some flexibility. This tutorial should give any developer the knowledge to create a dynamic file system that users access through WebDAV.

Notes

Currently, WCK is only available from CVS. For more information on accessing Slide from CVS, check http://jakarta.apache.org/site/cvsindex.htmlThe easiest way to get everything done on any platform (downloading from CVS, buidling from ant, etc...) is to use Eclipse IDE. (Tutorials for Eclipse can be found within Eclipse itself, inside its help menu.)

WCK works for Slide 2.1 and above. However since WCK is only available through CVS, it would be safer to assume that WCK is only compatible with the latest from CVS Head. (Hopefully for the 2.2 release, WCK will be included with the binaries to avoid this problem.)

Servlet Container and App Server Setup

Depending on your familiarity with the application server, this section can either be easy or very difficult. Hopefully, this information will ease some of the pain.

If you have successfully used Slide with JBoss, any other servlet container, or application server, please post some information it does not have to be formal and neat - anything is better than nothing.

WebDAV Client Issues

Mac OS X

The standard Mac OS X client will by default create meta files that start with "._". It will also try to create a '/Content' or '/Content/PkgInfo' directory.

Goliath

Goliath will display ghost directories.

Windows XP

Basics

WCK essentially allows easy creation of a custom Slide Store class. In general a store class is responsible for displaying and storing files. Given this flexibility, you can store files in a variety of ways (database, regular file system, and so on) and have a consistent interface for which users to access these files.

Essential Interface to Implement

The following functions are basically all Slide and WCK need to make basic WebDAV operations work (you need to implement them).

* Important Note: Remember that Slide itself will be using your store to create its own system files (/roles, /users, and other folders and files). Therefore it would be wise to implement all of BasicWebdavStore's functions unless otherwise noted - even if your users will not be allowed to perform certain functions - such as creating new folders or deleting. Hint: when the system is using your store to create the files and directories it needs - the Principal parameter object is null.

1.begin, commit, rollback:

a. begin Only the begin function is really required to implement from group one. The begin function is called on every webdav client request. If you look at the reference implementation of WebdavFileStore, it doesn't implement either commit or rollback.

b. commit This commits a transaction. This is not required to implement.

c. rollback This aborts a transaction. This is not required to implement.

As of Slide 2.1 these functions on Mac OS X, regardless of whether your store implements these functions correctly Slide will still return incorrect values regarding these file properties. However, do not be tempted to return a static value. While text files will be unaffected, other files like images may become corrupted when you retrieve the file.

1.getAuthenticationSession (2x one with user/password one with user only): asks if a certain user exists and authenticated itself correctly and if so an object that allows access to your system, i.e. a session or connection or anything similiar, is passed back; in case the user has already authenticated correctly before only the user with no password is passed

The "callback-store" parameter value must point to your WebdavFileStore implementation (remember your class must implement the BasicWebdavStore interface - as shown above). Here the given WebdavFileStore reference store implementation. It is recommended that you analyze it.

Overring the slide.properties file

Depending on what you want to do, you may need to override the slide.properties file. For more details check the SlidePropertiesFile documentation.

Correct way to interoperate with Slide locks

Posted by Alessandro Apostoli to the Slide user list

I have a static Map to hold the lockids to be returned by getLockInfo(). Every call to lockObject() generates an exclusive lock on my proprietary system and stores the pair (uri,lockId) in the map for later retrieval, this for webdav locks only. Each call to getLockInfo() first checks if there is a lock in the proprietary system and if not it returns a SimpleLock[0] If the resource is locked it has to determine if it was locked via webdav or via proprietary interface so it checks if there's an entry in the map for that lock. If so it returns it, if there's no entry in the map and the resource is locked it has to generate a valid lockId, store it in the map for subsequent calls to getLockInfo() and return it. My system supports only one lock per resource so the key in my map is the uri, I also used the uri to generate the lockId string with a call to DigestUtils.md5Hex(uri). As one might expect a call to unlockObject() removes the entry from the map and unlocks the resource.