mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 16:06:08 +00:00
Add getCookiesString method in OwnCloudClient
This commit is contained in:
parent
a42f6b5d6d
commit
e7a0e30a27
@ -416,5 +416,30 @@ public class OwnCloudClient extends HttpClient {
|
||||
|
||||
}
|
||||
|
||||
public String getCookiesString(){
|
||||
Cookie[] cookies = getState().getCookies();
|
||||
String cookiesString ="";
|
||||
for (Cookie cookie: cookies) {
|
||||
cookiesString = cookiesString + cookie.toString() + ";";
|
||||
|
||||
logCookie(cookie);
|
||||
}
|
||||
|
||||
return cookiesString;
|
||||
|
||||
}
|
||||
|
||||
private void logCookie(Cookie cookie) {
|
||||
Log.d(TAG, "Cookie name: "+ cookie.getName() );
|
||||
Log.d(TAG, " value: "+ cookie.getValue() );
|
||||
Log.d(TAG, " domain: "+ cookie.getDomain());
|
||||
Log.d(TAG, " path: "+ cookie.getPath() );
|
||||
Log.d(TAG, " version: "+ cookie.getVersion() );
|
||||
Log.d(TAG, " expiryDate: " +
|
||||
(cookie.getExpiryDate() != null ? cookie.getExpiryDate().toString() : "--"));
|
||||
Log.d(TAG, " comment: "+ cookie.getComment() );
|
||||
Log.d(TAG, " secure: "+ cookie.getSecure() );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -166,19 +166,14 @@ public class SingleSessionManager implements OwnCloudClientManager {
|
||||
OwnCloudClient client = clientsPerAccount.get(credentials);
|
||||
|
||||
if (client != null) {
|
||||
|
||||
Cookie[] cookies = client.getState().getCookies();
|
||||
String cookiesString ="";
|
||||
for (Cookie cookie: cookies) {
|
||||
cookiesString = cookiesString + cookie.toString() + ";";
|
||||
|
||||
logCookie(cookie);
|
||||
}
|
||||
String cookiesString = client.getCookiesString();
|
||||
if (cookiesString != "") {
|
||||
ac.setUserData(savedAccount, Constants.KEY_COOKIES, cookiesString);
|
||||
Log.d(TAG, "Saving Cookies: "+ cookiesString );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -198,17 +193,5 @@ public class SingleSessionManager implements OwnCloudClientManager {
|
||||
|
||||
}
|
||||
|
||||
private void logCookie(Cookie cookie) {
|
||||
Log.d(TAG, "Cookie name: "+ cookie.getName() );
|
||||
Log.d(TAG, " value: "+ cookie.getValue() );
|
||||
Log.d(TAG, " domain: "+ cookie.getDomain());
|
||||
Log.d(TAG, " path: "+ cookie.getPath() );
|
||||
Log.d(TAG, " version: "+ cookie.getVersion() );
|
||||
Log.d(TAG, " expiryDate: " +
|
||||
(cookie.getExpiryDate() != null ? cookie.getExpiryDate().toString() : "--"));
|
||||
Log.d(TAG, " comment: "+ cookie.getComment() );
|
||||
Log.d(TAG, " secure: "+ cookie.getSecure() );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user