Code example for CookieStore

Methods: clear

0
     */ 
	public int authenticate(String username, String password) {
		HttpClient client = HttpUtils.getDefaultClient();
		HttpContext httpContext = HttpSessionContainer.INSTANCE.getSessionContext();
		CookieStore cookieStore = (CookieStore) httpContext.getAttribute(ClientContext.COOKIE_STORE);
		cookieStore.clear();
		int userId = 0;
		 
		try { 
			List<NameValuePair> credentials = generateCredentialsForPost(username, password);
			HttpPost post = new HttpPost(WARMSHOWERS_USER_AUTHENTICATION_URL);
			post.setEntity(new UrlEncodedFormEntity(credentials));
			HttpResponse response = client.execute(post, httpContext);
 
			HttpEntity entity = response.getEntity();
			String rawJson = EntityUtils.toString(entity, "UTF-8");
            if (rawJson.contains("Already logged in")) {
                return 0; 
            } 
 
            JsonParser parser = new JsonParser();