At first WebDAV appears complex, especially the spec. This article aims to introduce and clarify what WebDAV is and how it is used in OpenSAM.
Keep in mind that WebDAV support is built into Apache, Windows IIS, SharePoint, Windows XP, Mac OS, and virtually every popular server software stack available.
See also this Wikipedia article.
HTTP is the most successful protocol ever invented. It is how Web servers deliver pages to a browser. It combines underlying simplicity, extensibility, and maturity to enable modern services from YouTube to Wikis to Banking Online.
The "GET" HTTP request is familiar to us. It fetches a Web page or image from a Web server. The sublety is that HTTP also includes the "PUT" request that stores a document back to a server. Most often the "PUT" request is disabled or at the very least protected by HTTP Authentication to prevent malicious changes to server content.
WebDAV is a pure extension to HTTP and incorporates all the requests, headers, responses, URL namespace management, and other functionality built into HTTP.
Since Web 2.0 applications wish to work like desktop applications, they need a full filesystem to browse, read, and write files to. The HTTP GET and PUT requests give us part of a filesystem, but not all of it. The missing pieces are:
WebDAV is HTTP plus those capabilities. WebDAV also added the ability to create and store any meta-data attribute attached to a file in XML. This last addition (that goes beyond the typical filesystem) enables virtually unlimited collaboration, workflow, and structured data-intensive functionality built upon WebDAV.
Specifically, WebDAV adds the following request types to HTTP:
|
Request |
Description |
OpenSLIM Use |
OpenSAM Use |
|
PROPFIND |
This gets a directory listing of files including attributes. This is also how a client queries arbitrary meta-data about a file. |
No |
Yes |
|
PROPPATCH |
Sets file attributes or meta-data on a file. |
No |
Some |
|
MKCOL |
Creates a directory (a.k.a. folder). |
No |
Optional |
|
COPY |
Copy a file to another location in the URL namespace. |
No |
Not Yet |
|
MOVE |
Move a file to another location in the URL namespace. |
No |
Not Yet |
|
LOCK |
Lock a file, for perhaps a long time -- weeks. |
No |
Not Yet |
|
UNLOCK |
Unlocka file. |
No |
Not Yet |
Table WP 1.0
WebDAV in OpenSAM makes frequent use of these HTTP request types that are otherwise rarely used:
|
Request |
Description |
OpenSLIM Use |
OpenSAM Use |
|
PUT |
Stores a file to the server. |
Yes |
Yes |
|
DELETE |
Removes a file from the server. |
No |
Optional |
Table WP 1.1
As you can see from the tables, OpenSAM uses mostly PROPFIND. All the other OpenSAM functionality comes from the HTTP protocol roots within WebDAV. Even simpler, the OpenSLIM version of OpenSAM uses just the HTTP requests and none of WebDAV.
Apache, including its module mod_dav that adds WebDAV to any Apache server, runs just above the operating system's native filesystem. This means that, by default, the files read and written to WebDAV are stored directly as files on the server.
Many modern Web 2.0 services abstract their document hierarchy away from the file system and store them in a database or a combination of a database and a scalable, networked virtual filesystem. So how can you add WebDAV to your service?
Since your service runs on the Web via HTTP, you've already done most of the work. You've redirected Apache requests to a customized layer of code, probably a Java, PHP, Perl, Ruby, or other scripting layer. That code is fielding requests, managing the abstracted document hierarchy, and serving up responses. To add WebDAV to your service, you need to extend your server code to handle some of the request types in tables WP 1.0 and WP 1.1 within an HTTP authenticated mode.
You'll probably use a variety of Apache conf file directives to configure this, including Alias, AliasMatch, and others to send the appropriate requests to your script.
Here we illustrate a simple standard install of Apache + mod_dav serving WebDAV and a more sophisticated, programmed service serving WebDAV.
