Difference between revisions of "Documentation/DevGuide/AppendixC/The WebDAV Content Provider"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Robot: Changing Category:Appendix)
Line 163: Line 163:
  
 
{{PDL1}}
 
{{PDL1}}
[[Category: Appendix]]
+
 
 +
[[Category:Documentation/Developers Guide/Appendix]]

Revision as of 11:24, 4 June 2008




The WebDAV Content Provider (DCP) implements a content provider for the Universal Content Broker (UCB). An overview is provided at URLs http://www.webdav.org and http://www.fileangel.org/docs/DAV_2min.html. It provides access to WebDAV and standard HTTP servers. The DCP communicates with the server by using the WebDAV protocol that is an extension to the HTTP protocol, or by using the plain HTTP protocol if the server is not WebDAV-enabled.

DCP Contents

The DCP provides two types of content: a folder or document that corresponds to a collection or non-collection, of nodes and leafs, in WebDAV, respectively.

  1. A DCP folder is a container for other DCP Folders or Documents.
  2. A DCP document is a container for document data or content. The data or content can be any type. A WebDAV server, like an HTTP server, does not mandate what type of data or content is contained within Documents. The type of data or content is defined by the MediaType property which is different from the content type returned from the getContentType() method. The MediaType property is mapped to the equivalent WebDAV property and the WebDAV server calculates the value.
WebDav Content Provider

Creation of New DCP Contents

DCP folders implement the interface com.sun.star.ucb.XContentCreator. DCP documents and DCP folders support the command "insert". To create a new child of a DCP folder:

  1. The parent folder creates a new content by calling its createNewContent() method. The content type for new folders is "application/vnd.sun.star.webdav-collection". To create a new document, use the type string "application/http-content".
  2. Set a title for the new folder or document. The new child executes a "setPropertyValues" command that sets the property Title to a non-empty value.
  3. The new child, not the parent, executes the command "insert". This commits the creation process and makes the newly-created content on the WebDAV server persistent.

Authentication

DAV resources that require authentication are accessed using the interaction handler mechanism of the UCB. The DAV content calls an interaction handler supplied by the client to let it handle an authentication request. The implementation of the interaction handler collects the user name or password from a location, for example, a login dialog, and supplies this data as an interaction response.

Property Handling

In addition to the mandatory UCB properties, the DCP supports reading and writing all DAV live and dead properties. Some DAV live properties are mapped in addition to the UCB properties and conversely, that is, DAV:creationdate is mapped to DateCreated. Adding and removing dead properties is also supported by the implementation of the XPropertyContainer interface of a DCP content.

Property Values

The DCP cannot determine the semantics of unknown properties, thus the values of such properties will always be presented as plain text, as they were returned from the server.

Namespaces

The following namespaces are known to the DCP:

Properties with these namespaces are addressed using a UCB property name which is the concatenation of namespace and name, that is, DAV:getcontentlength.

Dead properties with namespaces that are not well-known to the DCP are addressed using a special UCB property name string, that contains both the namespace and the property name. A special property name string must be similar to the following:

  <prop:the_propname xmlns:prop="the_namespace">

The DCP internally applies the namespace http://ucb.openoffice.org/dav/props/ to all UCB property names that:

  • are not predefined by the UCB API.
  • do not start with a well-known namespace.
  • do not use the special property name string to encode namespace and name.

For example, a client does an addProperty( .... "MyAdditionalProperty" ... ). The resulting DAV property has the name MyAdditionalProperty, its namespace is http://ucb.openoffice.org/dav/props/. However, the DCP client never sees that namespace, but the client can always use the simple name MyAdditionalProperty.

DAV / UCB Property Mapping

DAV:creationdate DateCreated
DAV:getlastmodified DateModified
DAV:getcontenttype MediaType
DAV:getcontentlength Size
DAV:resourcetype (used to set IsFolder, IsDocument, ContentType)

URL Scheme for DCP Contents

Each DCP content has an identifier corresponding to the following scheme:

 vnd.sun.star.webdav://host:port/<path>

where <path> is a hierarchical path of the form

 <name>/<name>/.../<name>

where <name> is an encoded string according to the URL conventions.

It is also possible to use standard HTTP URLs. The implementation determines if the requested resource is DAV enabled.

Examples:

 vnd.sun.star.webdav://localhost/davhome/
 
 vnd.sun.star.webdav://davserver.com/Documents/report.sdw
 
 http://davserver.com/Documents/report.sdw

Template:Documentation/Note

Commands and Properties

UCB Type (returned by XContent::getContentType ) Properties Commands Interfaces
Docu-ment application/http-content [readonly] ContentType

[readonly] DateCreated
[readonly] DateModified
[readonly] IsDocument
[readonly] IsFolder
[readonly] MediaType
[readonly] Size
'Title'

getCommandInfo

getPropertySetInfo
getPropertyValues
setPropertyValues
insert
delete
open

XTypeProvider

XServiceInfo
XComponent
XContent
XCommandProcessor
XPropertiesChangeNotifier
XPropertyContainer
XPropertySetInfoChangeNotifier
XCommandInfoChangeNotifier
XChild

Folder application/vnd.sun.star.webdav-collection [readonly] ContentType

[readonly] DateCreated
[readonly] DateModified
[readonly] IsDocument
[readonly] IsFolder
[readonly] MediaType
[readonly] Size
Title

getCommandInfo

getPropertySetInfo
getPropertyValues
setPropertyValues
insert
delete
open
transfer

same as DCP Folder, plus

XContentCreator

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools