Code example for DefaultHttpClient

Methods: getCookieStore

0
     */ 
    private void setSidCookie(String cookie){
        BasicClientCookie c = new BasicClientCookie("JIFTY_SID_HIVEMINDER", cookie);
        c.setDomain(".hiveminder.com");
        c.setPath("/");
        mHttpClient.getCookieStore().addCookie(c);
    } 
    // save this cookie in our prefs. 
    public void saveSidCookie(){ 
        for( Cookie c : mHttpClient.getCookieStore().getCookies()){
            if("JIFTY_SID_HIVEMINDER".equals(c.getName())){
                Log.d(TAG, "saving sid cookie: "+ c.getValue());
                mPrefs.edit().putString("auth_cookie", c.getValue()).commit();
            } 
        } 
    } 
    // remove saved cookie. clear it from client. 
    // used from Preferences (for logout) 
    public void clearSidCookie(){ 
        this.setSidCookie("");
        mPrefs.edit().putString("auth_cookie", "").commit();