gpt4 book ai didi

java - Android 方法 MKCOL、http、addHeader、

转载 作者:行者123 更新时间:2023-12-02 00:45:47 24 4
gpt4 key购买 nike

- (FMWebDAVRequest*) createDirectory {
if (!_endSelector) {
_endSelector = @selector(requestDidCreateDirectory:);
}

NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:_url];

[req setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
[req setTimeoutInterval:60 * 5];

[req setHTTPMethod:@"MKCOL"];


if (![[NSUserDefaults standardUserDefaults] boolForKey:@"skipMKCOLContentType"]) {
[req setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"];
}

[self sendRequest:req];

return self;

此代码我用于 iPhone,我为两个平台编写 WebDav 客户端但我不知道如何为 android 实现 MKCOL,这就是我所做的MKCOL 它是创建路径的 WebDav 方法,有什么想法吗?

HttpPut request = new HttpPut();
request.addHeader("", "MKCOL /test879797 HTTP/1.1");
request.addHeader("Host","myserver:port");
request.addHeader("Authorization","Basic YWRtaW46MTIzNDU2");

最佳答案

使用以下代码:

public class HttpMkCol extends HttpEntityEnclosingRequestBase
{
public static final String METHOD_NAME = "MKCOL";
public HttpMkCol(String url)
{
this(URI.create(url));
}
public HttpMkCol(URI url)
{
this.setURI(url);
}
@Override
public String getMethod()
{
return METHOD_NAME;
}
}

原始出处: https://github.com/lookfirst/sardineHttpMkCol.java

关于java - Android 方法 MKCOL、http、addHeader、,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5059543/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com