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
@ -415,6 +415,31 @@ 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,16 +166,11 @@ public class SingleSessionManager implements OwnCloudClientManager {
|
|||||||
OwnCloudClient client = clientsPerAccount.get(credentials);
|
OwnCloudClient client = clientsPerAccount.get(credentials);
|
||||||
|
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
|
String cookiesString = client.getCookiesString();
|
||||||
Cookie[] cookies = client.getState().getCookies();
|
if (cookiesString != "") {
|
||||||
String cookiesString ="";
|
ac.setUserData(savedAccount, Constants.KEY_COOKIES, cookiesString);
|
||||||
for (Cookie cookie: cookies) {
|
Log.d(TAG, "Saving Cookies: "+ cookiesString );
|
||||||
cookiesString = cookiesString + cookie.toString() + ";";
|
}
|
||||||
|
|
||||||
logCookie(cookie);
|
|
||||||
}
|
|
||||||
ac.setUserData(savedAccount, Constants.KEY_COOKIES, cookiesString);
|
|
||||||
Log.d(TAG, "Saving Cookies: "+ cookiesString );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -197,18 +192,6 @@ 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