mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 07:56:19 +00:00
remove retrive cookies from middleware
This commit is contained in:
parent
2f952a3a09
commit
0d94058db9
@ -38,6 +38,7 @@ import com.owncloud.android.lib.common.authentication.OwnCloudCredentialsFactory
|
||||
import com.owncloud.android.lib.common.http.HttpClient;
|
||||
import com.owncloud.android.lib.common.http.HttpConstants;
|
||||
import com.owncloud.android.lib.common.http.methods.HttpBaseMethod;
|
||||
import com.owncloud.android.lib.common.http.methods.nonwebdav.HttpMethod;
|
||||
import com.owncloud.android.lib.common.network.RedirectionPath;
|
||||
import com.owncloud.android.lib.common.utils.RandomUtils;
|
||||
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
|
||||
@ -113,14 +114,17 @@ public class OwnCloudClient extends HttpClient {
|
||||
if (mCredentials.getHeaderAuth() != null && method.getRequestHeader(AUTHORIZATION_HEADER) == null) {
|
||||
method.setRequestHeader(AUTHORIZATION_HEADER, mCredentials.getHeaderAuth());
|
||||
}
|
||||
|
||||
status = method.execute();
|
||||
stacklog(status, method);
|
||||
/*
|
||||
synchronized (mHoldRequests) {
|
||||
while (mHoldRequests) {
|
||||
while (true) {
|
||||
try {
|
||||
((String) null).toString();
|
||||
throw new Exception("Stack log");
|
||||
} catch (Exception e) {
|
||||
Log.d("+++++++",
|
||||
"HATL BEFORE" +
|
||||
Timber.d( "HATL BEFORE" +
|
||||
"\nThread: " + Thread.currentThread().getName() +
|
||||
"\nobject: " + this.toString() +
|
||||
"\nMethod: " + method.getHttpUrl() +
|
||||
@ -134,10 +138,9 @@ public class OwnCloudClient extends HttpClient {
|
||||
mHoldRequests = true;
|
||||
while (mHoldRequests) {
|
||||
try {
|
||||
((String) null).toString();
|
||||
throw new Exception("Stack log");
|
||||
} catch (Exception e) {
|
||||
Log.d("+++++++",
|
||||
"HALT AFTER" +
|
||||
Timber.d( "HALT AFTER" +
|
||||
"\nresponsecode: " + Integer.toString(status) +
|
||||
"\nThread: " + Thread.currentThread().getName() +
|
||||
"\nobject: " + this.toString() +
|
||||
@ -147,7 +150,9 @@ public class OwnCloudClient extends HttpClient {
|
||||
Thread.sleep(40000);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
if (mFollowRedirects) {
|
||||
status = followRedirection(method).getLastStatus();
|
||||
@ -162,6 +167,21 @@ public class OwnCloudClient extends HttpClient {
|
||||
return status;
|
||||
}
|
||||
|
||||
private void stacklog(int status, HttpBaseMethod method) {
|
||||
try {
|
||||
throw new Exception("Stack log");
|
||||
} catch(Exception e) {
|
||||
Timber.d("\n---------------------------" +
|
||||
"\nresponsecode: " + status +
|
||||
"\nThread: " + Thread.currentThread().getName() +
|
||||
"\nobject: " + this.toString() +
|
||||
"\nMethod: " + method.toString() +
|
||||
"\nUrl: " + method.getHttpUrl() +
|
||||
"\ntrace: " + ExceptionUtils.getStackTrace(e) +
|
||||
"---------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
private int executeRedirectedHttpMethod(HttpBaseMethod method) throws Exception {
|
||||
boolean repeatWithFreshCredentials;
|
||||
int repeatCounter = 0;
|
||||
|
@ -42,17 +42,9 @@ public class OwnCloudClientFactory {
|
||||
*/
|
||||
public static OwnCloudClient createOwnCloudClient(Uri uri, Context context, boolean followRedirects) {
|
||||
OwnCloudClient client = new OwnCloudClient(uri);
|
||||
|
||||
client.setFollowRedirects(followRedirects);
|
||||
|
||||
HttpClient.setContext(context);
|
||||
retrieveCookiesFromMiddleware(client);
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
private static void retrieveCookiesFromMiddleware(OwnCloudClient client) {
|
||||
final GetRemoteStatusOperation statusOperation = new GetRemoteStatusOperation();
|
||||
statusOperation.run(client);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user