Commit 2ccaa4a4 authored by davigonz's avatar davigonz

Include move support

parent 10abc3ec
......@@ -85,6 +85,32 @@ open class DavResource @JvmOverloads constructor(
}
}
/**
* Sends a MOVE request to this resource. Follows up to [MAX_REDIRECTS] redirects.
*
* @throws IOException on I/O error
* @throws DavException on WebDAV error
*/
@Throws(IOException::class, HttpException::class, DavException::class)
fun move(destination:String, forceOverride:Boolean, callback: (response: Response) -> Unit) {
val requestBuilder = Request.Builder()
.method("MOVE", null)
.header("Content-Length", "0")
.header("Destination", destination);
if(forceOverride) requestBuilder.header("Overwrite", "F")
followRedirects {
requestBuilder.url(location)
httpClient.newCall(requestBuilder
.build())
.execute()
}.use{ response ->
checkStatus(response)
callback(response)
}
}
/**
* Sends a MKCOL request to this resource. Follows up to [MAX_REDIRECTS] redirects.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment