<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt"?>
<!DOCTYPE rfc SYSTEM 'rfc2629.dtd' [
<!ENTITY rfc2119 PUBLIC '' 'bibxml/reference.RFC.2119.xml'>
<!ENTITY rfc3339 PUBLIC '' 'bibxml/reference.RFC.3339.xml'>
<!ENTITY rfc3744 PUBLIC '' 'bibxml/reference.RFC.3744.xml'>
<!ENTITY rfc4791 PUBLIC '' 'bibxml/reference.RFC.4791.xml'>
<!ENTITY rfc4918 PUBLIC '' 'bibxml/reference.RFC.4918.xml'>
<!ENTITY rfc6352 PUBLIC '' 'bibxml/reference.RFC.6352.xml'>
<!ENTITY rfc7303 PUBLIC '' 'bibxml/reference.RFC.7303.xml'>
]>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc strict="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc ipr="trust200902" docName='draft-pot-webdav-notifications-03'>
    <front>
        <title abbrev="WebDAV User Notifications">WebDAV: User Notifications</title>
        <author initials="E." surname="Pot" fullname="Evert Pot">
            <organization abbrev="fruux GmbH">
                fruux GmbH
            </organization>
            <address>
                <postal>
                    <street>Koenigsstrasse 32</street>
                    <city>Muenster</city>
                    <region>NRW</region>
                    <code>48143</code>
                    <country>Germany</country>
                </postal>
                <email>me@evertpot.com</email>
                <uri>https://fruux.com/</uri>
            </address>
        </author>
        <author initials="C." surname="Daboo" fullname="Cyrus Daboo">
            <organization abbrev="Apple Inc.">
                Apple Inc.
            </organization>
            <address>
                <postal>
                    <street>1 Infinite Loop</street>
                    <city>Cupertino</city>
                    <region>CA</region>
                    <code>95014</code>
                    <country>USA</country>
                </postal>
                <email>cyrus@daboo.name</email>
                <uri>http://www.apple.com/</uri>
            </address>
        </author>
        <date/>
        <abstract>
            <t>
                This specification defines an extension to WebDAV that allows the server to provide notifications to users.
            </t>
        </abstract>
    </front>
    <middle>
        <section title='Introduction'>
            <t>
                It is often useful for servers to communicate arbitrary
                information to the end-users of a WebDAV system, such as a
                system status, message of the day or to notify users of
                changes that were made to shared resources by other users.
           </t>
           <t>
               This specification defines a generic "notification" mechanism
               that allows a server to do that. Whilst primarily aimed at
               <xref target="RFC4791">CalDAV</xref> and <xref target="RFC6352">CardDAV</xref>
               this mechanism has been designed to be adaptable to other
               applications of <xref target='RFC4918'>WebDAV</xref>.
           </t>
        </section>

        <section title='Conventions Used in This Document'>
           <t>
             The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in <xref target='RFC2119' />.
           </t>
           <t>
             When XML element types in the namespace "DAV:" is referenced
             in this document outside of the context of an XML fragment,
             the string "DAV:" will be prefixed to the element type name.
           </t>
            <t>
              The DTD samples used in this document are for illustrative
              purposes only. All XML documents in this document follow
              the conventions and restrictions described in
              <xref target="RFC4918" /> section 17.
            </t>
        </section>

        <section title="Requirements Overview">
            <t>
                To add support for WebDAV notifications, a server MUST at
                least have support for <xref target="RFC4918">WebDAV Class 3</xref>.
            </t>
            <t>
                WebDAV notifications also defines new properties on principal
                resources (<xref target="RFC3744">RFC3744</xref>), which is
                defined in Section 4.2.1.
            </t>
        </section>

        <section title="Notifications">
            <t>When this feature is available, a <xref target="DAV:notification-URL">DAV:notification-URL</xref> property appears on principal resources for those principals who are able to receive notifications. That property specifies a single DAV:href element whose content refers to a WebDAV collection resource. Notification "messages" are deposited into this collection and can be retrieved by clients and acted on accordingly.</t>
            <t>The notification collection referenced by the <xref target="DAV:notification-URL">DAV:notification-URL</xref> property MUST have a DAV:resourcetype property with DAV:collection and <xref target="DAV:notifications">DAV:notifications</xref> child elements.</t>
            <t>Notification "messages" are XML documents stored as resources in the notification collection. Each XML document contains a <xref target="DAV:notification">DAV:notification</xref> element as its root. The root element contains a DAV:dtstamp element, and one additional element which represents the type of notification being conveyed in the message. That child element will typically contain additional content that describes the notification.</t>
            <t>Each notification resource has a <xref target="DAV:notificationtype">DAV:notificationtype</xref> property which contains as its single child element an empty element that matches the child element of the notification resource XML document root. Any attributes on the child element in the XML document are also present in the property child element.</t>
            <t>Notifications are automatically generated by the server with an appropriate resource stored in the notifications collection of the user to whom the notification is targeted. Clients SHOULD monitor the notification collection looking for new notification resources. When doing so, clients SHOULD look at the <xref target="DAV:notificationtype">DAV:notificationtype</xref> property to ensure that the notification is of a type that the client can handle. Once a client has handled the notification in whatever way is appropriate it SHOULD delete the notification resource. Clients SHOULD remove notifications being displayed to a user when the notification resource is removed from the notification collection, to enable the user to dismiss a notification on one device and have it automatically removed from others. Clients MUST ignore all notifications for types they do not recognize. Servers MAY delete notification resources on their own if they determine that the notifications are no longer relevant or valid. Servers MAY coalesce notifications as appropriate.</t>
            <t>Servers MUST prevent clients from adding resources in the notification collection.</t>
            <section title="Mime type" anchor="mime-type">
                <t>
                    The "application/davnotification+xml" MIME media type MUST
                    be used for transfer of WebDAV notifications.
                </t>
                <t hangText="Example:">This is an example of a Content-Type header:
                  <figure>
                      <artwork><![CDATA[Content-Type: application/davnotification+xml]]></artwork>
                  </figure>
                </t>
                <t>
                    HTTP GET requests that expect to receive a WebDAV
                    notification resource, SHOULD include an "Accept" header
                    that includes "application/davnotification+xml".
                </t>
                <t>
                    Requests that do not include this header, SHOULD be
                    rejected with a HTTP 406 status code.
                </t>
            </section>
            <section title="Additional Principal Properties" anchor='principal-properties'>
                <t>This section defines new properties for WebDAV principal resources as defined in <xref target="RFC3744">RFC3744</xref>. These properties are likely to be protected but the server MAY allow them to be written by appropriate users.</t>
                <section title="DAV:notification-URL Property" anchor="DAV:notification-URL">
                  <t>
                    <list style="hanging">
                      <t hangText="Name:">notification-URL</t>
                      <t hangText="Namespace:">DAV:</t>
                      <t hangText="Purpose:">Identify the URL of the notification collection owned by the associated principal resource.</t>
                      <t hangText="Protected:">This property SHOULD be protected.</t>
                      <t hangText="PROPFIND behavior:">This property SHOULD NOT be returned by a PROPFIND allprop request (as defined in Section 14.2 of <xref target="RFC4918"/>).</t>
                      <t hangText="COPY/MOVE behavior:">This property value SHOULD be preserved in COPY and MOVE operations.</t>

                      <t hangText="Description:">This property is needed for a client to determine where the notification collection of the current user is located so that processing of notification messages can occur. If not present, then the associated principal is not enabled for notification messages on the server.</t>
                      <t hangText="Definition:">
                        <figure>
                          <artwork><![CDATA[
<!ELEMENT notification-URL (DAV:href)>]]></artwork>
                        </figure>
                      </t>
                    </list>
                  </t>
                </section>
            </section>
            <section title="Properties on Notification Resources" anchor='notification-properties'>
                <t>The following new WebDAV properties are defined for notification resources.</t>
                <section title="DAV:notificationtype Property" anchor="DAV:notificationtype">
                  <t>
                    <list style="hanging">
                      <t hangText="Name:">notificationtype</t>
                      <t hangText="Namespace:">DAV:</t>
                      <t hangText="Purpose:">Identify the type of notification of the corresponding resource.</t>
                      <t hangText="Protected:">This property MUST be protected.</t>
                      <t hangText="PROPFIND behavior:">This property SHOULD NOT be returned by a PROPFIND allprop request (as defined in Section 14.2 of <xref target="RFC4918"/>).</t>
                      <t hangText="COPY/MOVE behavior:">This property value MUST be preserved in COPY and MOVE operations.</t>

                      <t hangText="Description:">This property allows a client, via a PROPFIND Depth:1 request, to quickly find notification messages that the client can handle in a notification collection. The single child element is the notification resource root element's child defining the notification itself. This element MUST be empty, though any attributes on the element in the notification resource MUST be present in the property element.</t>
                      <t hangText="Definition:">
                        <figure>
                          <artwork><![CDATA[
<!ELEMENT notificationtype ANY>
<!-- Child elements are empty but will have appropriate attributes.
     Any valid notification message child element can appear.-->]]></artwork>
                        </figure>
                      </t>
                    </list>
                  </t>
                </section>
            </section>
            <section title='XML Element Definitions'>
                <section title="DAV:notifications" anchor="DAV:notifications">
                    <t>
                      <list style="hanging">
                        <t hangText="Name:">notifications</t>
                        <t hangText="Namespace:">DAV:</t>
                        <t hangText="Purpose:">Indicates a notification collection.</t>
                        <t hangText="Description:">This XML element is used in a DAV:resourcetype element to indicate that the corresponding resource is a notification collection.</t>
                        <t hangText="Definition:">
                          <figure>
                            <artwork><![CDATA[
<!ELEMENT notifications EMPTY>]]></artwork>
                          </figure>
                        </t>
                      </list>
                    </t>
                </section>
                <section title="DAV:notification" anchor="DAV:notification">
                    <t>
                      <list style="hanging">
                        <t hangText="Name:">notification</t>
                        <t hangText="Namespace:">DAV:</t>
                        <t hangText="Purpose:">Notification message root element.</t>
                        <t hangText="Description:">The root element used in notification resources.</t>
                        <t hangText="Definition:">
                          <figure>
                            <artwork><![CDATA[
<!ELEMENT notification (dtstamp, XXX) >
<!-- Any notification type element can appear after
     DAV:dtstamp -->]]></artwork>
                          </figure>
                        </t>
                      </list>
                    </t>
                </section>
              <section title="DAV:dtstamp" anchor="DAV:dtstamp">
                <t>
                  <list style="hanging">
                    <t hangText="Name:">dtstamp</t>
                    <t hangText="Namespace:">DAV:</t>
                    <t hangText="Purpose:">Date-time stamp.</t>
                    <t hangText="Description:">DAV:dtstamp is an element whose content MUST conform to the
                        "date-time" production in <xref target="RFC3339" />.  In addition, an uppercase "T"
                        character MUST be used to separate date and time, and an uppercase
                        "Z" character MUST be present.</t>
                    <t hangText="Definition:">
                      <figure>
                        <artwork><![CDATA[
<!ELEMENT dtstamp (#PCDATA)>
<!-- Value is a date-time in UTZ as per [RFC3339] -->]]></artwork>
                      </figure>
                    </t>
                  </list>
                </t>
              </section>
            </section>

        </section>

        <section title="Notification Definitions">
            <t>This section defines a set of common notification types.</t>
            <section title="System Status Notification">
                <t>The system status notification is used to convey an URI and/or textual description to the user. The assumption is that the URI points to a webpage where the current system status is described in detail, with the provided description being a summary of that. A "type" attribute on the element is used to indicate the importance of the current status notification, and has the values "low", "medium" and "high", representing the increasing level of importance of the message respectively.</t>
                <t>Servers might have knowledge of an agent's language preferences, in which case it MAY localise the DAV:description value as appropriate based on the calendar user accessing the notification, but if it does, it SHOULD include an xml:lang attribute on the DAV:description element to indicate what language is being used.</t>
                <section title="DAV:systemstatus Element Definition" anchor="DAV:systemstatus">
                    <t>
                      <list style="hanging">
                        <t hangText="Name:">systemstatus</t>
                        <t hangText="Namespace:">DAV:</t>
                        <t hangText="Purpose:">Indicates a system status notification.</t>
                        <t hangText="Description:">This XML element is used in a DAV:notification element to describe a system status notification.</t>
                        <t hangText="Definition:">
                          <figure>
                            <artwork><![CDATA[
<!ELEMENT systemstatus (DAV:href?, DAV:description?)>
<!ATTLIST systemstatus type (low | medium | high) "low">
<!-- One of DAV:href or DAV:description MUST be present -->
]]></artwork>
                          </figure>
                        </t>
                        <t hangText="Example:">This is an example of the body of a notification resource for an emergency system outage:
                          <figure>
                            <artwork><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<D:notification xmlns:D="DAV:">
  <D:dtstamp>2011-12-09T06:12:53Z</D:dtstamp>
  <D:systemstatus type="high">
    <D:href>http://example.com/emergency_shutdown.html</D:href>
    <D:description xml:lang='en_US'>
        Emergency shutdown now
    </D:description>
  </D:systemstatus>
</D:notification>]]></artwork>
                          </figure>
                        </t>
                        <t hangText="Example:">This is an example of the WebDAV property on the example notification resource above:
                          <figure>
                            <artwork><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<D:notificationtype xmlns:D="DAV:">
  <D:systemstatus type="high" />
</D:notificationtype>]]></artwork>
                          </figure>
                        </t>
                      </list>
                    </t>
                </section>
            </section>
        </section>

        <section title='Security Considerations' anchor="security">
            <t>
                TBD: More?
            </t>
        </section>
        <section title='IANA Considerations'>
            <t>
                This document defines a MIME media type for use of WebDAV
                notifications in an XML format. This media type SHOULD be used
                for the transfer of WebDAV notifications.
            </t>
            <t>
            <list style="hanging">
              <t hangText="Type name:">application</t>
              <t hangText="Subtype name:">davnotification+xml</t>
              <t hangText="Required parameters:">none</t>
              <t hangText="Optional parameters:">none</t>
              <t hangText="Encoding considerations:">Identical to those of "application/xml" as described in <xref target="RFC7303">RFC7303</xref>.</t>
              <t hangText="Security considerations:">See <xref target="security" />.</t>
              <t hangText="Interoperability considerations:">There are no known interoperability issues.</t>
              <t hangText="Published specification:">This specification.</t>
              <t hangText="Applications that use this media type:">No known applications currently use this media type.</t>
              <t hangText="Fragment identifier considerations:">N/A.</t>
            </list>
          </t>
          <t>Additional information</t>
          <t>
          <list style="hanging">
              <t hangText="Deprecated alias names for this type">N/A.</t>
              <t hangText="Magic number(s)">N/A.</t>
              <t hangText="File extension(s)">xml</t>
              <t hangText="Macintosh file type code(s)">TEXT</t>
              <t hangText="Person &amp; email address to contact for further information:">me@evertpot.com</t>
              <t hangText="Intended usage">COMMON</t>
              <t hangText="Restrictions on usage">There are no restrictions on where this media</t>
              <t hangText="Author">See the "Authors' Addresses" section of this document.</t>
              <t hangText="Change Controller">IETF</t>
          </list>
          </t>
        </section>
        <section title='Acknowledgments'>
          <t>
             The authors would like to thank the members of the Calendaring and
             Scheduling Consortium's SharingTechnical Committee. In particular,
             the following individuals have made important contributions to
             this work: Richard Brigham, John Chaffee, Michael Douglass and
             Ken Murchison and Dave Thewlis.
           </t>
           <t>
             This specification originated from work at the Calendaring and
             Scheduling Consortium, which has supported the development and
             testing of implementations of the specification.
           </t>
        </section>
    </middle>
    <back>
        <references title='Normative References'>
            &rfc2119;
            &rfc3339;
            &rfc4918;
            &rfc7303;
        </references>
        <references title='Informative References'>
            &rfc3744;
            &rfc4791;
            &rfc6352;
        </references>
        <section title='Backwards-compatibility with earlier drafts'>
            <t>
                An earlier draft of this specification is already widely
                deployed among both servers and clients.
            </t>
            <t>
                That draft, informally known as 'caldav-notifications'
                largely uses the same structure as this specification, but
                where the "DAV:" xml namespace is used in this specification,
                the earlier draft uses "http://calendarserver.org/ns/".
            </t>
            <t>
                It is possible to conform to both that draft and this
                specification by either creating two different collections, as
                identified by "notification-URL" in each respective namespace.
                Alternatively it's possible to use the same resource for
                both, but use content-negotation using the Accept header to
                ask the server for a specific representation of a notification.
            </t>
        </section>
        <section title='Change History (to be removed prior to publication as an RFC'>
            <t>Changes in -03:
                <list style='numbers'>
                  <t>Fixed a number of spelling / language issues..</t>
                </list>
            </t>
            <t>Changes in -02:
                <list style='numbers'>
                    <t>No significant changes.</t>
                </list>
            </t>
            <t>Changes in -01:
                <list style='numbers'>
                    <t>Added a paragraph about xml/dtd handling with a reference to RFC4917</t>
                </list>
            </t>
        </section>
    </back>
</rfc>
