1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-08 08:26:10 +00:00

Use callback to get okhttp response

This commit is contained in:
davigonz 2018-07-18 11:49:06 +02:00
parent 4968ca6e62
commit e0e6d3da49
4 changed files with 8 additions and 13 deletions

View File

@ -175,8 +175,6 @@ public class OwnCloudClient extends HttpClient {
return status; return status;
} }
public RedirectionPath followRedirection(HttpBaseMethod method) throws Exception { public RedirectionPath followRedirection(HttpBaseMethod method) throws Exception {
int redirectionsCount = 0; int redirectionsCount = 0;
int status = method.getStatusCode(); int status = method.getStatusCode();

View File

@ -24,7 +24,6 @@
package com.owncloud.android.lib.common.http.methods.webdav; package com.owncloud.android.lib.common.http.methods.webdav;
import com.owncloud.android.lib.common.http.HttpClient;
import com.owncloud.android.lib.common.http.methods.HttpBaseMethod; import com.owncloud.android.lib.common.http.methods.HttpBaseMethod;
import java.net.URL; import java.net.URL;
@ -32,7 +31,6 @@ import java.util.concurrent.TimeUnit;
import at.bitfire.dav4android.Constants; import at.bitfire.dav4android.Constants;
import at.bitfire.dav4android.DavOCResource; import at.bitfire.dav4android.DavOCResource;
import at.bitfire.dav4android.DavResource;
import at.bitfire.dav4android.exception.RedirectException; import at.bitfire.dav4android.exception.RedirectException;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
@ -62,7 +60,7 @@ public abstract class DavMethod extends HttpBaseMethod {
public int execute() throws Exception { public int execute() throws Exception {
try { try {
return onExecute(); return onExecute();
} catch(RedirectException e) { } catch (RedirectException e) {
return getStatusCode(); return getStatusCode();
} }
} }

View File

@ -28,6 +28,7 @@ import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import at.bitfire.dav4android.Property; import at.bitfire.dav4android.Property;
import at.bitfire.dav4android.Response; import at.bitfire.dav4android.Response;
import at.bitfire.dav4android.exception.DavException; import at.bitfire.dav4android.exception.DavException;
@ -71,7 +72,6 @@ public class PropfindMethod extends DavMethod {
case OTHER: case OTHER:
default: default:
} }
return Unit.INSTANCE; return Unit.INSTANCE;
}, response -> { }, response -> {
mResponse = response; mResponse = response;
@ -82,7 +82,7 @@ public class PropfindMethod extends DavMethod {
return davException.getCode(); return davException.getCode();
} }
return super.getStatusCode(); return getStatusCode();
} }
public int getDepth() { public int getDepth() {

View File

@ -77,7 +77,6 @@ public class ExistenceCheckRemoteOperation extends RemoteOperation {
@Override @Override
protected RemoteOperationResult run(OwnCloudClient client) { protected RemoteOperationResult run(OwnCloudClient client) {
try { try {
client.setFollowRedirects(true); client.setFollowRedirects(true);
PropfindMethod propfindMethod = new PropfindMethod( PropfindMethod propfindMethod = new PropfindMethod(