WebDAV的最小请求响应周期的实施例?(Example of a minimal request

2019-07-28 23:27发布

是否有一个典型的请求 - 响应周期的最小(可能注释)例如,具有两个头和主体。 据我了解,这个由最初的选择和后续PROPFIND交换 - 在此之后,GET和PUT应该是简单的,所以我并不需要一个通用的例子在那里。

我一直在考虑通过WebDAV将现有RESTful资源(集合和内个别项目)。 我只需要基本功能的工作 - 列出目录,读取和写入文件 - 这AFAICT意味着添加PROPFIND支持就足够了。

Answer 1:

本说明书包括示例:

最小

请求:

OPTIONS /somecollection/ HTTP/1.1
Host: example.org

响应:

HTTP/1.1 200 OK
Allow: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, COPY, MOVE
Allow: MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK, ORDERPATCH
DAV: 1, 2, ordered-collections

实际

请求:

  PROPFIND /somecollection HTTP/1.1
    Depth: 0
    Content-Type: text/xml; charset="utf-8"
    Content-Length: xxx

    <?xml version="1.0" encoding="UTF-8" ?>
    <propfind xmlns="DAV:">
      <prop>
        <supported-live-property-set/>
        <supported-method-set/>
      </prop>
    </propfind>

响应:

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

<?xml version="1.0" encoding="utf-8" ?>
<multistatus xmlns="DAV:">
  <response>
    <href>http://example.org/somecollection</href>
    <propstat>
      <prop>
        <supported-live-property-set>
          <supported-live-property>
            <prop><ordering-type/></prop>
          </supported-live-property>
          <!-- ... other live properties omitted for brevity ... -->
        </supported-live-property-set>
        <supported-method-set>
          <supported-method name="COPY" />
          <supported-method name="DELETE" />
          <supported-method name="GET" />
          <supported-method name="HEAD" />
          <supported-method name="LOCK" />
          <supported-method name="MKCOL" />
          <supported-method name="MOVE" />
          <supported-method name="OPTIONS" />
          <supported-method name="ORDERPATCH" />
          <supported-method name="POST" />
          <supported-method name="PROPFIND" />
          <supported-method name="PROPPATCH" />
          <supported-method name="PUT" />
          <supported-method name="TRACE" />
          <supported-method name="UNLOCK" />
        </supported-method-set>
      </prop>
      <status>HTTP/1.1 200 OK</status>
    </propstat>
  </response>
</multistatus>


文章来源: Example of a minimal request response cycle for WebDAV?
标签: http webdav