Loading src/main/java/at/bitfire/dav4android/DavResource.kt +19 −2 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ open class DavResource @JvmOverloads constructor( /** WebDAV properties of this resource */ val properties = PropertyCollection() /** whether a 507 Insufficient Storage was found in the response */ /** whether a 507 Insufficient Storage was found in the previous response */ var furtherResults = false /** members of this resource */ Loading Loading @@ -83,6 +83,7 @@ open class DavResource @JvmOverloads constructor( */ @Throws(IOException::class, HttpException::class, DavException::class) fun options() { resetResponse() capabilities.clear() val response = httpClient.newCall(Request.Builder() Loading @@ -103,6 +104,8 @@ open class DavResource @JvmOverloads constructor( */ @Throws(IOException::class, HttpException::class) fun mkCol(xmlBody: String?) { resetResponse() val rqBody = if (xmlBody != null) RequestBody.create(MIME_XML, xmlBody) else null var response: Response? = null Loading Loading @@ -130,6 +133,8 @@ open class DavResource @JvmOverloads constructor( */ @Throws(IOException::class, HttpException::class, DavException::class) fun get(accept: String): ResponseBody { resetResponse() var response: Response? = null for (attempt in 1..MAX_REDIRECTS) { response = httpClient.newCall(Request.Builder() Loading Loading @@ -171,6 +176,8 @@ open class DavResource @JvmOverloads constructor( */ @Throws(IOException::class, HttpException::class) fun put(body: RequestBody, ifMatchETag: String?, ifNoneMatch: Boolean): Boolean { resetResponse() var redirected = false var response: Response? = null for (attempt in 1..MAX_REDIRECTS) { Loading Loading @@ -211,6 +218,8 @@ open class DavResource @JvmOverloads constructor( */ @Throws(IOException::class, HttpException::class) fun delete(ifMatchETag: String?) { resetResponse() var response: Response? = null for (attempt in 1..MAX_REDIRECTS) { val builder = Request.Builder() Loading Loading @@ -248,6 +257,8 @@ open class DavResource @JvmOverloads constructor( */ @Throws(IOException::class, HttpException::class, DavException::class) fun propfind(depth: Int, vararg reqProp: Property.Name) { resetResponse() // build XML request body val serializer = XmlUtils.newSerializer() val writer = StringWriter() Loading Loading @@ -567,7 +578,8 @@ open class DavResource @JvmOverloads constructor( } // set properties for target target.furtherResults = insufficientStorage if (insufficientStorage) target.furtherResults = true target.properties.merge(properties, true) } Loading @@ -590,6 +602,7 @@ open class DavResource @JvmOverloads constructor( } } resetResponse() try { parser.setInput(reader) Loading Loading @@ -660,4 +673,8 @@ open class DavResource @JvmOverloads constructor( related.clear() } protected fun resetResponse() { furtherResults = false } } Loading
src/main/java/at/bitfire/dav4android/DavResource.kt +19 −2 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ open class DavResource @JvmOverloads constructor( /** WebDAV properties of this resource */ val properties = PropertyCollection() /** whether a 507 Insufficient Storage was found in the response */ /** whether a 507 Insufficient Storage was found in the previous response */ var furtherResults = false /** members of this resource */ Loading Loading @@ -83,6 +83,7 @@ open class DavResource @JvmOverloads constructor( */ @Throws(IOException::class, HttpException::class, DavException::class) fun options() { resetResponse() capabilities.clear() val response = httpClient.newCall(Request.Builder() Loading @@ -103,6 +104,8 @@ open class DavResource @JvmOverloads constructor( */ @Throws(IOException::class, HttpException::class) fun mkCol(xmlBody: String?) { resetResponse() val rqBody = if (xmlBody != null) RequestBody.create(MIME_XML, xmlBody) else null var response: Response? = null Loading Loading @@ -130,6 +133,8 @@ open class DavResource @JvmOverloads constructor( */ @Throws(IOException::class, HttpException::class, DavException::class) fun get(accept: String): ResponseBody { resetResponse() var response: Response? = null for (attempt in 1..MAX_REDIRECTS) { response = httpClient.newCall(Request.Builder() Loading Loading @@ -171,6 +176,8 @@ open class DavResource @JvmOverloads constructor( */ @Throws(IOException::class, HttpException::class) fun put(body: RequestBody, ifMatchETag: String?, ifNoneMatch: Boolean): Boolean { resetResponse() var redirected = false var response: Response? = null for (attempt in 1..MAX_REDIRECTS) { Loading Loading @@ -211,6 +218,8 @@ open class DavResource @JvmOverloads constructor( */ @Throws(IOException::class, HttpException::class) fun delete(ifMatchETag: String?) { resetResponse() var response: Response? = null for (attempt in 1..MAX_REDIRECTS) { val builder = Request.Builder() Loading Loading @@ -248,6 +257,8 @@ open class DavResource @JvmOverloads constructor( */ @Throws(IOException::class, HttpException::class, DavException::class) fun propfind(depth: Int, vararg reqProp: Property.Name) { resetResponse() // build XML request body val serializer = XmlUtils.newSerializer() val writer = StringWriter() Loading Loading @@ -567,7 +578,8 @@ open class DavResource @JvmOverloads constructor( } // set properties for target target.furtherResults = insufficientStorage if (insufficientStorage) target.furtherResults = true target.properties.merge(properties, true) } Loading @@ -590,6 +602,7 @@ open class DavResource @JvmOverloads constructor( } } resetResponse() try { parser.setInput(reader) Loading Loading @@ -660,4 +673,8 @@ open class DavResource @JvmOverloads constructor( related.clear() } protected fun resetResponse() { furtherResults = false } }