DAV Maintenance tutorial
DAV Properties DAV properties - PROPFIND and PROPPATCH

## DAV properties

Every collection resource has standard (computed) properties, and can have user-defined properties.

## Computed Properties

The computed properties are set by DAV server. The user-agents do not handle it. The computed resources are in the DAV name space. The computed properties are:

- creationdate (#PCDATA) - when created
- getcontentlength (#PCDATA) - length of the content
- getcontenttype (#PCDATA) - mime type of the content
- getetag (#PCDATA) - Etag of the resource
- getlastmodified (#PCDATA) - when the resource is modified
- lockdiscovery (activelock)* - active lock information
- resourcetype ANY - type of the resource (applicable only for collections)
- supportedlock (lockentry)* - what lock supported

## User Defined Properties

- For other application specific purposes the PROPPATCH request can be used to set other properties.
- The Virtuoso WebDAV server process by special way the following properties.
- xml-sql - text of the SQL query to produce an XML document.
- xml-sql-root - the root element name of the produced XML document.
- xml-stylesheet - the URL of the associated XSL-T style-sheet.
- xml-sql-dtd - the external DTD link or 'on' in case of inline DTD.
- xml-sql-schema - the external XMLSchema link.
- xper - persistent XML storage.

## Property handling

- If an XML document has a property xml-stylesheet, then the retrieved content will be transformed and sent instead of the original document content.
- The xml-sql and xml-sql-root work together. If the resource has these properties, and the content length is 0, then WebDAV server will execute the SQL query (see xml_auto()), and the generated XML document will be sent to the user-agent.
- If no xml-sql-root is associated, then the root element will be defaulted to the 'document'.
- The xper property signals to the server that each member of the collection must be stored as XML persistent.
- If the xper property is removed from a collection, then each currently stored persistent XML document will revert to a normal text/xml at the next update. Each xper property will be removed.

## Example PROPFIND Request

       PROPFIND /DAV/images/davadmin.jpg HTTP/1.1
       Host: localhost:6666
       Content-Type: text/xml
       Depth: 1
       Content-Length: 269
       Authorization:

       <?xml version="1.0" encoding="utf-8"?>
       <propfind xmlns="DAV:"><prop>
       <getcontentlength xmlns="DAV:"/>
       <getlastmodified xmlns="DAV:"/>
       <displayname xmlns="DAV:"/>
       <executable xmlns="http://apache.org/dav/props/"/>
       <resourcetype xmlns="DAV:"/>
       </prop></propfind>

## Response

       HTTP/1.1 207 Multi-Status
       Server: Virtuoso
       Content-type: text/xml; charset="utf-8"
       Content-Length: 652

       <?xml version="1.0" encoding="utf-8"?>
       <D:multistatus xmlns:D="DAV:">
       <D:response xmlns:lp0="DAV:" xmlns:i0="DAV:">
       <D:href>/DAV/images/davadmin.jpg</D:href>
       <D:propstat>
       <D:prop>
       <lp0:getcontentlength>5725</lp0:getcontentlength>
       <lp0:getlastmodified>Mon, 14 May 2001 13:26:54 GMT</lp0:getlastmodified>
       <D:resourcetype/>
       </D:prop>
       <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
       <D:propstat>
       <D:prop>
       <i0:displayname/>
       <i0:executable/>
       </D:prop>
       <D:status>HTTP/1.1 404 Not Found</D:status>
       </D:propstat>
       </D:response>
       </D:multistatus>

## Example PROPPATCH Request

       PROPPATCH /bar.html HTTP/1.1
       Host: www.foo.com
       Content-Type: text/xml; charset="utf-8"
       Content-Length: xxxx

       <?xml version="1.0" encoding="utf-8" ?>
       <D:propertyupdate xmlns:D="DAV:"
       xmlns:Z="http://www.w3.com/standards/z39.50/">
         <D:set>
              <D:prop>
                   <Z:authors>
                        <Z:Author>Jim Whitehead</Z:Author>
                        <Z:Author>Roy Fielding</Z:Author>
                   </Z:authors>
              </D:prop>
         </D:set>
         <D:remove>
              <D:prop><Z:Copyright-Owner/></D:prop>
         </D:remove>
       </D:propertyupdate>

## Response

       HTTP/1.1 207 Multi-Status
       Content-Type: text/xml; charset="utf-8"
       Content-Length: xxxx

       <?xml version="1.0" encoding="utf-8" ?>
       <D:multistatus xmlns:D="DAV:"
       xmlns:Z="http://www.w3.com/standards/z39.50">
         <D:response>
              <D:href>http://www.foo.com/bar.html</D:href>
              <D:propstat>
                   <D:prop><Z:Authors/></D:prop>
                   <D:status>HTTP/1.1 424 Failed Dependency</D:status>
              </D:propstat>
              <D:propstat>
                   <D:prop><Z:Copyright-Owner/></D:prop>
                   <D:status>HTTP/1.1 409 Conflict</D:status>
              </D:propstat>
         </D:response>
       </D:multistatus>