This module is view-only. You do not have an enrolement for this module.

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.

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.