Android HttpClient to accept all cookies -


i'm pretty new in android world , maybe question simple.. have android app use httpget connect server , collect data. server sets cookies not remembered code. found post using custom cookie policy , accepting everything.. need.but cant implement it.as understand version of java httpclient old , not have functions need. here's code:

try {         httpclient client = new defaulthttpclient();         httpget = new httpget(link);          get.getparams().setparameter(                 clientpnames.cookie_policy, cookiepolicy.browser_compatibility);          httpresponse responseget = client.execute(get,ctx);         status_code = responseget.getstatusline().getstatuscode();         httpentity resentityget = responseget.getentity();          if (resentityget != null) {             http_response = entityutils.tostring(resentityget);         }      } 

and code need implement:

    cookiestore cookiestore = new basiccookiestore();  httpclient.setcookiestore(cookiestore); cookiespecfactory csf = new cookiespecfactory() {     public cookiespec newinstance(httpparams params) {         return new browsercompatspec() {             @override             public void validate(cookie cookie, cookieorigin origin)                     throws malformedcookieexception {                 log.debug("allow cookies");             }         };     } }; httpclient.getcookiespecs().register("easy", csf); httpclient.getparams().setparameter(         clientpnames.cookie_policy, "easy"); 

all need set csf policy client. seems dont have these 2 functions in library : setcookiestore , getcookiespecs().register()

what options run ?!


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -