4.1 Basic Components

A WebDAV resource is an addressable Web object, such as a file or directory. An ordinary resource can be viewed as a file. It can have a content body of any MIME type [RFC2045], [RFC2046], including HTML-formatted text, other text, an image, an executable, or an Office document. It can have locks and properties. The specification for URI Syntax [RFC2396] defines a resource as "anything that has identity." HTTP/1.1 [RFC2616] defines a resource both as "a network data object or service" and "anything that has a URI." The WebDAV specification does not redefine a resource but works from these definitions.

A collection resource follows all the same rules as a regular resource: It has a URL and properties, and it can be locked. Normally, a collection has no content body or an undefined content body. A collection has added functionality because it can contain other resources. Collections can be nested to form a hierarchy or tree to organize resources.

Terminology: Resource and Collection

Although it's convenient to think of a resource as either a file or a directory, we use the word resource more frequently because it's well defined and because it includes both concepts. The word collection always refers to a WebDAV collection resource. File and directory are used to talk about file system objects outside of the context of WebDAV. The words child and parent indicate a direct relationship between a resource and the collection that contains it. Descendants covers all the resources inside a collection, whether they are directly inside the collection or within subcollections.


A lock is a restriction placed on a resource. Usually, it restricts users other than the owner of the lock from making any changes on the resource. A lock has a token to identify it, but that token is meaningful only in the context of the resource that is locked.

A property is a name/value pair on a resource. Any resource can have any set of properties. A property is not independently addressable, but each property has a qualified name that uniquely identifies it on the resource where it appears.

In all figures in this book, a couple of conventions are used to represent resources, locks, and properties. Figure 4-1 introduces most of those conventions.

Figure 4-1. Figure conventions.

graphics/04fig01.jpg

Resources are represented with icons. Hierarchy is represented as a tree with dashed lines, sometimes arranged the same way an Explorer-style client displays hierarchy. Properties are represented as iconic tables to represent a list of property/value pairs. Locks are represented with a shaded box to show the scope of the lock.

A property name is actually an XML qualified name, which means that it combines a short, readable element name with a unique XML namespace.

Locks and properties are bound to individual resources. For example, to create a lock, the client must request that the resource be locked by giving the resource's address.

XML Names, Qualified Names, and Namespaces

The base XML recommendation [Bray00] defined elements and element names. An XML document can have an element named status with a text value:

 
 <status>200</status> 

An element name like "status" is such a common word that different applications quickly collide with each other. "Status" could mean response status, e-commerce order status, or a purchaser's credit status. The XML namespaces recommendation [Bray99] addresses this issue with qualified names, which are names distinguished with a unique namespace. The namespace can be very long in order to ensure uniqueness, so in any XML document each namespace may be given a nickname or prefix. Prefixes are completely arbitrary, so each prefix must be defined in the scope where it is used. Here, the prefix is a1 and the namespace is http://example.com/expenses/.

 
 <a1:status xmlns:a1='http://example.com/expenses/'> <a1:paid-in-full/></a1:status> 


A WebDAV repository is a collection of WebDAV resources hosted at the same server address. Within a repository, it's possible to move and copy files from one collection to another. This isn't a concept defined or required for the WebDAV specification, but it's very useful to talk about WebDAV behavior.



WebDAV. Next Generation Collaborative Web Authoring
WebDAV. Next Generation Collaborative Web Authoring
ISBN: 130652083
EAN: N/A
Year: 2003
Pages: 146

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net