Introduction to Webdav locking
Webdav includes an optional locking mechanism to support concurrency safety in multi-user environments. This is an optional feature for webdav servers and most common webdav clients will use locking if its available, but will function correctly without it. Plain webdav servers, without locking support, are referred to as DAV level 1 servers and those with locking are referred to as DAV level 2 servers.
DAV Levels and Milton Licensing
Milton community edition is an apache licensed project and supports DAV Level 1.
DAV Level 2 multi-user concurrency features are typically required for professional or enterprise applications so is supported by Milton's Enterprise edition. This library is usually licensed commercially for a fee, although it can be freely used by projects which are themselves licensed on the Affero GPL license (typically academic and educational organisations).
Please see the Milton license page for details.
Webdav's locking feature supports both creation of locks on resources (ie locking the resource), discovery of locks and the enforcement of restrictions on locked resources.
Locking resources has two broad use cases:
- Locking an existing resource
- Locking a resource immediately prior to its creation
The first use case is easily understood and implemented, but the second is a bit tricky. This is referred to as the lock-null method, and it has rather awkward semantics. When a LOCK is issued on a non-existing resource the specification requires a placeholder resource to be created, and the lock persisted, but at this point the server does not know what type of resource it will be - it could be a file or a folder.
Milton supports both of those use cases with two interfaces:
- LockableResource - for locking existing resources
- LockingCollectionResource - for locking yet-to-be-created resources
The rest of this module will cover the implementation of those interfaces, please click Next to continue.