Implementing LockableResource

This page will cover how to implement the simpler of the two interfaces, LockableResource

Your implementation needs to create a lock on the specified resource, and this lock information must be returned on subsequent calls to getCurrentLock etc. Note that some developers new to milton hack the implementation and just return static data or nulls - this will not work in practise. Webdav clients are very particular about the lock state of a resource and they don't like it when things arent what they expect!

Usually you'll want to store locks in a database, but its often acceptable to hold locks in memory provided the information is shared across your cluster (if you have a cluster).

If you're using a single server, and if your resources have a not-null and immutable uniqueId field you can use Milton's SimpleLockManager, which is often a good way to get started.

Next Article:

Implement LockingCollectionResource