New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TIMOB-2849 Android: Set-Cookie Response Headers Only Returns Max of One Cookie #474
Conversation
…e into timob-2849
Changed cookie store to be thread-safe
@@ -0,0 +1,194 @@ | |||
/** | |||
* Appcelerator Titanium Mobile | |||
* Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update Copyright to 2011
Code Reviewed. Request Accepted |
I think this needs to be simplified. TiCookieStore is only needed once in the application. It should be a singleton with a .getInstance() like TiApplication.getInstance(). Nothing needs to go into the NetworkModule. When the singleton TiCookieStore needs a context for .getSharedPreferences(), it can just use the TiApplication's context. |
The manner in which the |
I currently have one preference that contains the list of all the cookies keys that are stored in preferences and then for each cookie, I use the cookie key for the preference key, and the cookie value for the value. I need to store the list of all the cookie keys in one preference key, since I don't have a way of knowing the which cookies are in preferences at startup. At startup, I iterate through the list of all cookie keys to populate the cookiestore. |
I'm pretty sure there's a way to get the cookie keys (the keys in the preferences) at startup without storing them all in one. Check the SharedPreferences documentation -- there's some method that gives you everything back as a Map, and then from the Map object you can get keys. (If I remember correctly.) That way we can avoid these string operations like splitting by comma, concatenating, etc. |
Functional test and code review accepted. w00t! Don needs to re-code-rev. |
Code Reviewed. Request Accepted. |
TIMOB-2849 Android: Set-Cookie Response Headers Only Returns Max of One Cookie
Added a shared cookie store for TiHTTPClient.
For testing: use the original app.js snippet from the bug description. To test the persistent cookiestore functionality do the following: