WTClient 中的 PROPFIND 请求
我想向我的应用程序添加 WebDAV 和 iDisk 接口,但是我在服务器上存储的文件方面遇到了一些技术问题。 “如何使用 WebDAV 服务器 || 获取文件列表”似乎以短语“使用 PROPFIND”结尾 要求。”我决定使用 WTClient 类,因为它们为我建立和终止到服务器的流并管理上传和下载,但 WTClient 失败的地方如下:它无法收集服务器上的文件列表(或者我似乎无法收集一份清单,无论你的船是什么)。它使用以下行放入 PROPFIND 请求:
WTHTTPConnection *connection = [[WTHTTPConnection alloc] initWithDestination:remoteURL
protocol:@"PROPFIND"];
然后将结果收集为 NSDictionary
。但 WTClient 不是使用该字典来获取文件列表,而是使用它从字典中的 XML 收集错误代码信息(如果存在)。虽然有帮助,但这不是我想要的。如果有人对如何请求 WebDAV 服务器上的文件并将它们收集到 NSDictionary
或 NSArray
中有最模糊的想法,我们将不胜感激。
I would like to add a WebDAV and iDisk interface to my app, however I am having a bit of technical trouble regarding files stored on the server. Every answer to the question "How do I use a WebDAV server || to get a list of files" seems to end with the phrase "Use a PROPFIND request." I've decided to use the WTClient Classes because they establish and terminate the stream to the server for me and manage uploads and downloads, but here's where WTClient fails: It cannot gather a list of files on the server (or I seem to be unable to gather a list, whatever floats your boat). It puts in the PROPFIND request with this line:
WTHTTPConnection *connection = [[WTHTTPConnection alloc] initWithDestination:remoteURL
protocol:@"PROPFIND"];
It then gathers the results as an NSDictionary
. But instead of using that dictionary to get a list of files, WTClient uses it to gather error code information (if present) from the XML in the dictionary. While helpful, it is not what I'm looking for. If anyone has even the foggiest idea of how to request the files on a WebDAV server and gather them into an NSDictionary
or NSArray
, it would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从WTClient的来源来看,您需要使用
initWithLocalURL
、preparePropertiesConnection
和/或requestProperties
来实现您想要的。OTOH 从来源中的一些评论来看,特别是。
PROPFIND
周围的功能(这确实是从 WebDAV 获取目录列表所必需的)尚未完全实现......所以这可能不适用于您的用例。更新:
这是一个 WebDAV 客户端库,包括已在 iOS 上成功使用的源代码(只需很少的修改)。它包括
PROPFIND
和其他特定于 WebDAV 的 http 动词的实现...对我来说,这对您来说似乎是一个很好的起点。Judging from source of WTClient you need to use
initWithLocalURL
,preparePropertiesConnection
and/orrequestProperties
to achieve what you want.OTOH it seems from some comments in the source that esp. the functionality around
PROPFIND
(which is indeed necessary to get a directory listing from WebDAV) is not fully implemented yet... so it might be that this would not work for your use case.UPDATE:
This is a WebDAV-client library including source which has been successfully used on iOS (with very little modification). It include an implementation for
PROPFIND
and other WebDAV-specific http verbs... to me it seems that this would be nice starting point for you.