android - Using Cookies with Robospice Retrofit requests -
can please suggest me way manage cookies in robospice retrofit type http requests.
i have authentication system has login , few http requests , , logout.
during login need save session , use same session rest http requests , when logout session has cleared.
here login http post request sends , recieves data through json format. using robospice retrofit manages login , logout requests.
you can set system-wide cookie-handler via java.net.cookiemanager
cookiemanager cookiemanager = new cookiemanager(); cookiemanager.setcookiepolicy(cookiepolicy.accept_all); cookiehandler.setdefault(cookiemanager);
in custom application
class.
to clear cookies after logout can use method this
public void clearcookies() { cookiemanager.getcookiestore().removeall(); }
Comments
Post a Comment