Code example for BasicClientCookie

Methods: setDomain, setPath

0
    } 
 
    /** set the session ID cookie for Hiveminder. 
     */ 
    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)