Created
January 22, 2013 21:40
-
-
Save joshdholtz/4598699 to your computer and use it in GitHub Desktop.
Stuff and things for cookies and things
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param cookie the cookie to set | |
*/ | |
public String setCookie(HttpResponse response, Context context) { | |
for (int i = 0; i < response.getAllHeaders().length; ++i) { | |
Log.d(Constants.LOG, response.getAllHeaders()[i].getName() + " - " + response.getAllHeaders()[i].getValue()); | |
} | |
Header[] cookies = response.getHeaders("Set-Cookie"); | |
if (cookies.length > 0) { | |
Log.d(Constants.LOG, "ClientSession - found cookie = " + cookies[0].getValue()); | |
this.setCookie(cookies[0].getValue(), context); | |
return cookies[0].getValue(); | |
} else { | |
Log.d(Constants.LOG, "ClientSession - could not find cookie in response"); | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment