Java 类com.loopj.android.http.PersistentCookieStore 实例源码

项目:oschina-app    文件:AppContext.java   
@Override
public void onCreate() {
    super.onCreate();
    // 注册App异常崩溃处理器
    // Thread.setDefaultUncaughtExceptionHandler(AppException.getAppExceptionHandler());

    CacheManager.initCacheDir(Constants.CACHE_DIR, getApplicationContext(),
            new DBHelper(getApplicationContext(), 1, "app_cache", null, null));

    instance = this;

    AsyncHttpClient client = new AsyncHttpClient();
    PersistentCookieStore myCookieStore = new PersistentCookieStore(this);
    client.setCookieStore(myCookieStore);
    ApiHttpClient.setHttpClient(client);
    ApiHttpClient.setCookie(ApiHttpClient.getCookie(this));

    EmojiHelper.initEmojis();
    initImageLoader(this);

    MobclickAgent.setDebugMode(false);
    UpdateConfig.setDebug(false);

    requestDailyEnglish();
}
项目:Coding-Android    文件:MyImageDownloader.java   
@Override
protected HttpURLConnection createConnection(String url, Object extra) throws IOException {
    HttpURLConnection conn = super.createConnection(url, extra);

    if (url.startsWith(Global.HOST)) {
        PersistentCookieStore cookieStore = new PersistentCookieStore(context);
        List<Cookie> cookies = cookieStore.getCookies();

        String sid = "";
        for (Cookie item : cookies) {
            if (item.getName().equals("sid")) {
                sid = "sid=" + item.getValue();
                break;
            }
        }

        conn.setRequestProperty("Cookie", sid);
    }

    return conn;
}
项目:Coding-Android    文件:MyAsyncHttpClient.java   
public static AsyncHttpClient createClient(Context context) {
    AsyncHttpClient client = new AsyncHttpClient();
    PersistentCookieStore cookieStore = new PersistentCookieStore(context);
    client.setCookieStore(cookieStore);
    if (!Global.HOST.equals(Global.DEFAULT_HOST)) {
        AccountInfo.CustomHost customHost = AccountInfo.getCustomHost(context);
        client.addHeader("Authorization", customHost.getCode()); // 有可能会有密码
    }

    for (String item : mapHeaders.keySet()) {
        client.addHeader(item, mapHeaders.get(item));
    }

    client.setTimeout(60 * 1000);
    return client;
}
项目:Coding-Android    文件:Global.java   
public static void syncCookie(Context context) {
    PersistentCookieStore cookieStore = new PersistentCookieStore(context);
    List<Cookie> cookies = cookieStore.getCookies();

    CookieSyncManager.createInstance(context);
    CookieManager cookieManager = CookieManager.getInstance();
    for (int i = 0; i < cookies.size(); i++) {
        Cookie eachCookie = cookies.get(i);
        cookieManager.setCookie(Global.HOST, String.format("%s=%s; Domain=%s; Path=%s; Secure; HttpOnly",
                eachCookie.getName(), eachCookie.getValue(), eachCookie.getDomain(),
                eachCookie.getPath()));
    }

    CookieSyncManager.getInstance().sync();

}
项目:eshow-android    文件:BaseActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

    httpClient = new AsyncHttpClient();
    PersistentCookieStore myCookieStore = new PersistentCookieStore(this);
    httpClient.setCookieStore(myCookieStore);
    httpClient.setTimeout(10000);

    fragmentManager = getSupportFragmentManager();

    setContentView();
    loadDialog = getRequestDg(this);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
    initViews();
    initHead();
    initDatas();

    setDatas();

    setListener();

}
项目:AomYim-Pantip    文件:PantipRestClient.java   
public PantipRestClient(Context context) {
    this.context = context;
    client = new AsyncHttpClient();
    PersistentCookieStore myCookieStore = new PersistentCookieStore(context);
    client.setCookieStore(myCookieStore);
    client.setMaxRetriesAndTimeout(2, 10);
    client.addHeader("origin", "http://pantip.com");
    client.addHeader("Content-Type", "application/x-www-form-urlencoded");
    client.addHeader("X-Requested-With", "XMLHttpRequest");
    client.addHeader("Accept", "application/json, text/javascript, */*; q=0.01");
    client.addHeader("Accept-Encoding", "gzip,deflate,sdch");
    client.addHeader(
            "User-Agent",
            "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36"
    );
    client.addHeader("Referer", "http://pantip.com/login?redirect=Lw==");
    client.addHeader("Accept-Language", "en-US,en;q=0.8,th;q=0.6");

}
项目:WeCenterMobile-Android    文件:WelcomeActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    PersistentCookieStore cookieStore = new PersistentCookieStore(
            WelcomeActivity.this);
    FanfanSharedPreferences fanfanSharedPreferences = new FanfanSharedPreferences(
            WelcomeActivity.this);
    boolean LoginStatus = fanfanSharedPreferences.getLogInStatus(false);
    String uid = fanfanSharedPreferences.getUid("");
    String userName = fanfanSharedPreferences.getUserName("");
    String passwd = fanfanSharedPreferences.getPasswd("");
    if (LoginStatus != false && !uid.equals("") && !passwd.equals("")
            && !userName.equals("") && cookieStore.getCookies().size() != 0) {
        Intent intent = new Intent(WelcomeActivity.this, MainActivity.class);
        startActivity(intent);
        finish();
    }
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.welcome);
    init();
}
项目:WeCenterMobile-Android    文件:MainActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    // �û�������ť
    if (id == R.id.feedback) {
        FeedbackAgent agent = new FeedbackAgent(MainActivity.this);
        agent.startFeedbackActivity();
    }
    if (id == R.id.logout) {
        sharedPreferences.clear();
        PersistentCookieStore cookieStore = new PersistentCookieStore(
                MainActivity.this);
        cookieStore.clear();
        Intent intent = new Intent(this, MainActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
        return true;
    }
    return super.onOptionsItemSelected(item);
}
项目:WeCenterMobile-Android    文件:AskingFragmentActivity.java   
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle arg0) {
    // TODO Auto-generated method stub
    super.onCreate(arg0);
    setContentView(R.layout.question_pager);
    actionBar = getActionBar();
    actionBar.setIcon(null);
    actionBar.setTitle("提问");
    actionBar.setDisplayUseLogoEnabled(false);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.show();
    text1 = new AskingFragment();
    text2 = new DetailFragment();
    text3 = new TagFragment();
    cursor = (ImageView) findViewById(R.id.cursor);
    attach_access_key = md5(getAttachKey());
    client = new AsyncHttpClient();
    myCookieStore = new PersistentCookieStore(this);
    client.setCookieStore(myCookieStore);
    progressDialog = new MyProgressDialog(this, "正在上传", "稍等...", false);
    InitTextView();
    InitImageView();
    InitViewPager();

}
项目:WeCenterMobile-Android    文件:AsyncFileUpLoad.java   
public AsyncFileUpLoad(Context context, String url, String filePath,
        CallBack callBack) {
    Log.i("url", url);
    Log.i("filePath", filePath);
    this.context = context;
    this.url = url;
    file = new File(filePath);
    NetworkState networkState = new NetworkState();
    client = new AsyncHttpClient();
    PersistentCookieStore mCookieStore = new PersistentCookieStore(context);
    client.setCookieStore(mCookieStore);
    if (networkState.isNetworkConnected(context)) {
        //Login();
        upLoad(callBack);
    } else {
        showTips(R.drawable.tips_error, R.string.net_break);
    }

}
项目:WeCenterMobile-Android    文件:WriteAnswerActivity.java   
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.write_answer);
    actionBar = getActionBar();
    actionBar.setIcon(null);
    actionBar.setTitle("�ش�");
    actionBar.setDisplayUseLogoEnabled(false);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.show();
    Intent intent = getIntent();
    question_id = intent.getStringExtra("questionid");
    attach_access_key = md5(getAttachKey());
    dp = getResources().getDimension(R.dimen.dp);
    editText = (EditText) findViewById(R.id.answerdetil);
    selectimg_horizontalScrollView = (HorizontalScrollView) findViewById(R.id.selectimg_horizontalScrollView);
    gridview = (GridView) findViewById(R.id.noScrollgridview);
    gridview.setSelector(new ColorDrawable(Color.TRANSPARENT));
    client = new AsyncHttpClient();
    myCookieStore = new PersistentCookieStore(this);
    client.setCookieStore(myCookieStore);
    progressDialog = new MyProgressDialog(this, "���ڼ�����", "���Ժ�...", false);
    gridviewInit();
}
项目:UltimateAndroid    文件:HttpUtilsAsync.java   
/**
 * Perform a HTTP GET request with cookies which are defined in hashmap
 *
 * @param context
 * @param url
 * @param hashMap
 * @param responseHandler
 */
public static void getUseCookie(Context context, String url, HashMap hashMap, AsyncHttpResponseHandler responseHandler) {
    PersistentCookieStore myCookieStore = new PersistentCookieStore(context);
    if (BasicUtils.judgeNotNull(hashMap)) {
        Iterator iterator = hashMap.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry entry = (Map.Entry) iterator.next();
            Object key = entry.getKey();
            Object value = entry.getValue();
            Cookie cookie = new BasicClientCookie(key.toString(), value.toString());
            myCookieStore.addCookie(cookie);
        }
    }
    AsyncHttpClient client = new AsyncHttpClient();
    client.setCookieStore(myCookieStore);
    client.get(getAbsoluteUrl(url), responseHandler);
}
项目:UltimateAndroid    文件:HttpUtilsAsync.java   
/**
 * Perform a HTTP POST request with cookies which are defined in hashmap
 *
 * @param context
 * @param url
 * @param hashMap
 * @param responseHandler
 */
public static void postUseCookie(Context context, String url, HashMap hashMap, AsyncHttpResponseHandler responseHandler) {
    PersistentCookieStore myCookieStore = new PersistentCookieStore(context);
    if (BasicUtils.judgeNotNull(hashMap)) {
        Iterator iterator = hashMap.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry entry = (Map.Entry) iterator.next();
            Object key = entry.getKey();
            Object value = entry.getValue();
            Cookie cookie = new BasicClientCookie(key.toString(), value.toString());
            myCookieStore.addCookie(cookie);
        }
    }
    AsyncHttpClient client = new AsyncHttpClient();
    client.setCookieStore(myCookieStore);
    client.post(getAbsoluteUrl(url), responseHandler);
}
项目:ima_intellj    文件:AppContext.java   
@Override
public void onCreate() {
    super.onCreate();
    // 注册App异常崩溃处理器
    // Thread.setDefaultUncaughtExceptionHandler(AppException.getAppExceptionHandler());

    instance = this;

    init2();
    AsyncHttpClient client = new AsyncHttpClient();
    PersistentCookieStore myCookieStore = new PersistentCookieStore(this);
    client.setCookieStore(myCookieStore);
    ApiHttpClient.setHttpClient(client);
    ApiHttpClient.setCookie(ApiHttpClient.getCookie(this));

    EmojiHelper.initEmojis();
    initImageLoader(this);

    MobclickAgent.setDebugMode(false);
    UpdateConfig.setDebug(false);

    requestDailyEnglish();
}
项目:books    文件:BaseResource.java   
/**
 * Resource initialization.
 * @param context Context
 */
protected static void init(Context context) {
    PersistentCookieStore cookieStore = new PersistentCookieStore(context);
    client.setCookieStore(cookieStore);

    if (USER_AGENT == null) {
        USER_AGENT = "Sismics Reader Android " + ApplicationUtil.getVersionName(context) + "/Android " + Build.VERSION.RELEASE + "/" + Build.MODEL;
        client.setUserAgent(USER_AGENT);
    }

    if (ACCEPT_LANGUAGE == null) {
        Locale locale = Locale.getDefault();
        ACCEPT_LANGUAGE = locale.getLanguage() + "_" + locale.getCountry();
        client.addHeader("Accept-Language", ACCEPT_LANGUAGE);
    }
}
项目:Android-ImageManager    文件:MainActivity.java   
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    gridView = (GridView)findViewById(R.id.gridView);

    final PersistentCookieStore myCookieStore = new PersistentCookieStore(this);
    httpClient.setCookieStore(myCookieStore);

    if (!DiskLruImageCache.isInitialized()) {
        new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(final Void... params) {
                DiskLruImageCache.getInstance(MainActivity.this);
                return null;
            }

            @Override
            protected void onPostExecute(final Void result) {
                initGrid();
            }
        }.execute();
    }
}
项目:GitHub    文件:PersistentCookiesSample.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    // Use the application's context so that memory leakage doesn't occur.
    cookieStore = new PersistentCookieStore(getApplicationContext());

    // Set the new cookie store.
    getAsyncHttpClient().setCookieStore(cookieStore);

    super.onCreate(savedInstanceState);
}
项目:GitHub    文件:PersistentCookiesSample.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    // Use the application's context so that memory leakage doesn't occur.
    cookieStore = new PersistentCookieStore(getApplicationContext());

    // Set the new cookie store.
    getAsyncHttpClient().setCookieStore(cookieStore);

    super.onCreate(savedInstanceState);
}
项目:Coding-Android    文件:AttachmentsDownloadDetailActivity.java   
private void download(String url) {
    try {
        mFile = FileUtil.getDestinationInExternalPublicDir(getFileDownloadPath(), mFileObject.getSaveName(mProjectObjectId));

        PersistentCookieStore cookieStore = new PersistentCookieStore(AttachmentsDownloadDetailActivity.this);
        String cookieString = "";
        for (Cookie cookie : cookieStore.getCookies()) {
            cookieString += cookie.getName() + "=" + cookie.getValue() + ";";
        }

        DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
        request.addRequestHeader("Cookie", cookieString);
        request.setDestinationInExternalPublicDir(getFileDownloadPath(), mFileObject.getSaveName(mProjectObjectId));
        request.setTitle(mFileObject.getName());
        // request.setDescription(mFileObject.name);
        // request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
        request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN);
        request.setVisibleInDownloadsUi(false);
        // request.allowScanningByMediaScanner();
        // request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
        // request.setShowRunningNotification(false);

        downloadId = downloadManager.enqueue(request);
        downloadListEditor.putLong(mFileObject.file_id, downloadId);
        downloadListEditor.commit();
    } catch (Exception e) {
        Toast.makeText(this, R.string.no_system_download_service, Toast.LENGTH_LONG).show();
    }

}
项目:Coding-Android    文件:FileDownloadBaseActivity.java   
private void download(ArrayList<AttachmentFileObject> mFileObjects) {
        try {
            for (AttachmentFileObject mFileObject : mFileObjects) {
                final String urlDownload = Global.HOST_API + "%s/files/%s/download";
                String url = String.format(urlDownload, getProjectPath(), mFileObject.file_id);

                PersistentCookieStore cookieStore = new PersistentCookieStore(this);
                String cookieString = "";
                for (Cookie cookie : cookieStore.getCookies()) {
                    cookieString += cookie.getName() + "=" + cookie.getValue() + ";";
                }

                DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
                request.addRequestHeader("Cookie", cookieString);
                request.setDestinationInExternalPublicDir(getFileDownloadPath(), mFileObject.getSaveName(getProjectId()));
                request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN);
                request.setTitle(mFileObject.getName());
                request.setVisibleInDownloadsUi(false);


                long downloadId = downloadManager.enqueue(request);
                downloadListEditor.putLong(mFileObject.file_id + mFileObject.getHistory_id(), downloadId);
//                backgroundUpdate(downloadId);
            }
            downloadListEditor.commit();
            mUpdateDownloadHandler.start();
            checkFileDownloadStatus();
        } catch (Exception e) {
            Toast.makeText(this, R.string.no_system_download_service, Toast.LENGTH_LONG).show();
        }
    }
项目:Microsoft_Band    文件:BandApplication.java   
private void init() {
    // 初始化网络请求
    AsyncHttpClient client = new AsyncHttpClient();
    PersistentCookieStore myCookieStore = new PersistentCookieStore(this);
    client.setCookieStore(myCookieStore);
    ApiHttpClient.setHttpClient(client);
    ApiHttpClient.setCookie(ApiHttpClient.getCookie(this));
}
项目:CarPathRecorder    文件:HttpClient.java   
private static AsyncHttpClient getAsyncClient(Context context){
    if(mAsyncClient == null){
        mAsyncClient = new AsyncHttpClient();
    //    mAsyncClient.addHeader("Accept-Encoding", "gzip");
        PersistentCookieStore myCookieStore = new PersistentCookieStore(context);
        mAsyncClient.setCookieStore(myCookieStore);
    }
    return mAsyncClient;
}
项目:WeiboWeiBaTong    文件:PersistentCookiesSample.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    // Use the application's context so that memory leakage doesn't occur.
    cookieStore = new PersistentCookieStore(getApplicationContext());

    // Set the new cookie store.
    getAsyncHttpClient().setCookieStore(cookieStore);

    super.onCreate(savedInstanceState);
}
项目:yuedong-app    文件:AppContext.java   
private void init() {
    // init the http client service
    AsyncHttpClient client = new AsyncHttpClient();
    PersistentCookieStore mCookieStore = new PersistentCookieStore(this);
    client.setCookieStore(mCookieStore);
    ApiHttpClient.setHttpClient(client);
    ApiHttpClient.setCookie(ApiHttpClient.getCookie(this));
    // init volley compoments
    initNewAPI();
    // init the local data
    isFirstStart();
    userDao = new LocalUserDaoImpl();
    // load the settings
    startNotification();
}
项目:Piggate-Android-SDK    文件:Piggate.java   
private void internal_constructor(Context context,BaseBridge bridge){
    APP_ID=getMetadata(context,"com.piggate.sdk.ApplicationId");
    _cookieStore = new PersistentCookieStore(context);
    PiggateRestClient.setCookieStore(_cookieStore);
    _bridge =bridge;
    notificationManager = (NotificationManager) _context.getSystemService(getApplicationContext().NOTIFICATION_SERVICE);
}
项目:school_shop    文件:MyAsyncHttpClient.java   
public static AsyncHttpClient createClient(Context context) {
    AsyncHttpClient client = new AsyncHttpClient();
    PersistentCookieStore cookieStore = new PersistentCookieStore(context);
    client.setCookieStore(cookieStore);

    return client;
}
项目:android-connection-handler    文件:ConnectionHandler.java   
private void createCookieIfNotSet() {
    synchronized (mCookieLock) {
        if (!hasCookie()) {
            mCookieStore = new PersistentCookieStore(mApplicationContext);
            mHttpContext = new BasicHttpContext();
            mHttpContext.setAttribute(ClientContext.COOKIE_STORE, mCookieStore);
        }
    }
}
项目:blogplu    文件:AppContext.java   
private void init() {
    // 初始化网络请求
    AsyncHttpClient client = new AsyncHttpClient();
    PersistentCookieStore myCookieStore = new PersistentCookieStore(this);
    client.setCookieStore(myCookieStore);
    ApiHttpClient.setHttpClient(client);
    ApiHttpClient.setCookie(ApiHttpClient.getCookie(this));

    // Log控制器
    KJLoger.openDebutLog(true);
    TLog.DEBUG = BuildConfig.DEBUG;

    // Bitmap缓存地址
    BitmapConfig.CACHEPATH = "OSChina/imagecache";
}
项目:DoubanOnline    文件:MyApplication.java   
/**
 * 由于百度Api库的原因,这个方法会被调用两次
 * 
 * */
@Override
public void onCreate()
{
    super.onCreate();
    applicationContext = this;
    instance = this;
    APP_RUNNING = true;
    VERSION_CODE = VersionUtil.getVersionCode();
    myCookieStore = new PersistentCookieStore(MyApplication.applicationContext);
    iniImageLoader();
    L.isDebug = true;//是否开启日志调试。发布的时候需要关闭
}
项目:ShanBay    文件:BaseApplication.java   
public void onCreate()
  {
    onConfigure();
//    if (Config.SENTRY_ENABLE)
//      Sentry.init(this, Config.DSN);
    super.onCreate();
    Misc.disableConnectionReuseIfNecessary();
    this.cookieStore = new PersistentCookieStore(this);
  }
项目:taijiquanwang    文件:AppContext.java   
@Override
public void onCreate() {
    super.onCreate();
    // 注册App异常崩溃处理器
    // Thread.setDefaultUncaughtExceptionHandler(AppException.getAppExceptionHandler());

    CacheManager.initCacheDir(Constant.CACHE_DIR, getApplicationContext(),
            new DBHelper(getApplicationContext(), 1, "app_cache", null, null));
    instance = this;
    AsyncHttpClient client = new AsyncHttpClient();
    PersistentCookieStore myCookieStore = new PersistentCookieStore(this);
    client.setCookieStore(myCookieStore);
    EmojiHelper.initEmojis();
}
项目:MZ-Android    文件:App.java   
/**
 * 退出的时候清除数据
 */
public void cleanUpInfo() {
    //清楚所有缓存
    DataPool dp =  new DataPool(DataPool.SP_Name_Publicer, this);
    dp.removeAll();

    DataPool dp1 =  new DataPool(DataPool.SP_Name_Employer, this);
    dp1.removeAll();

    PersistentCookieStore cs = new PersistentCookieStore(this);
    cs.clear();

}
项目:WeiboWeiBaTong    文件:PersistentCookiesSample.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    // Use the application's context so that memory leakage doesn't occur.
    cookieStore = new PersistentCookieStore(getApplicationContext());

    // Set the new cookie store.
    getAsyncHttpClient().setCookieStore(cookieStore);

    super.onCreate(savedInstanceState);
}
项目:v2ex-daily-android    文件:V2EX.java   
private static AsyncHttpClient getClient(Context context){
    if(sClient == null){
        sClient = new AsyncHttpClient();
        sClient.setEnableRedirects(false);
        sClient.setCookieStore(new PersistentCookieStore(context));
        sClient.setUserAgent("Mozilla/5.0 (Linux; U; Android 4.2.1; en-us; M040 Build/JOP40D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30");
        sClient.addHeader("Cache-Control", "max-age=0");
        sClient.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
        sClient.addHeader("Accept-Charset", "utf-8, iso-8859-1, utf-16, *;q=0.7");
        sClient.addHeader("Accept-Language", "zh-CN, en-US");
        sClient.addHeader("X-Requested-With", "com.android.browser");
    }
    return sClient;
}
项目:UltimateAndroid    文件:HttpUtilsAsync.java   
/**
 * Perform a HTTP GET request with cookie which generate by own context
 *
 * @param context
 * @param url
 * @param responseHandler
 */
public static void getWithCookie(Context context, String url, AsyncHttpResponseHandler responseHandler) {
    AsyncHttpClient client = new AsyncHttpClient();
    PersistentCookieStore myCookieStore = new PersistentCookieStore(context);
    //  myCookieStore.clear();
    client.setCookieStore(myCookieStore);
    client.get(getAbsoluteUrl(url), responseHandler);

}
项目:UltimateAndroid    文件:HttpUtilsAsync.java   
/**
 * Perform a HTTP POST request with cookie which generate by own context
 *
 * @param context
 * @param url
 * @param responseHandler
 */
public static void postWithCookie(Context context, String url, AsyncHttpResponseHandler responseHandler) {
    AsyncHttpClient client = new AsyncHttpClient();
    PersistentCookieStore myCookieStore = new PersistentCookieStore(context);
    //  myCookieStore.clear();
    client.setCookieStore(myCookieStore);
    client.post(getAbsoluteUrl(url), responseHandler);
}
项目:flow-android    文件:FlowAsyncClient.java   
public static void init(Context c) {
    cookieStore = new PersistentCookieStore(c);
    client.setCookieStore(cookieStore);

    preferences = PreferenceManager.getDefaultSharedPreferences(c);
    csrfToken = preferences.getString(CSRF_PREFERENCE_KEY, null);
    useCsrfToken();
}
项目:LightMeeting-Android    文件:App.java   
public void cleanUpInfo() {
    // 清除所有缓存
    DataPool dp = new DataPool(DataPool.SP_Name_User, this);
    dp.removeAll();

    PersistentCookieStore cs = new PersistentCookieStore(this);
    cs.clear();

}
项目:codereview.chromium    文件:ServerCaller.java   
public ServerCaller(Context context) {
    this.context = context;
    service = Executors.newFixedThreadPool(N_THREADS);
    httpClient = AndroidHttpClient.newInstance("");
    httpContext = new BasicHttpContext();
    httpContext.setAttribute(ClientContext.COOKIE_STORE, new PersistentCookieStore(context));
    reset();
}
项目:books    文件:PreferenceUtil.java   
/**
 * Returns auth token cookie from shared preferences.
 * @return Auth token
 */
public static String getAuthToken(Context context) {
    PersistentCookieStore cookieStore = new PersistentCookieStore(context);
    List<Cookie> cookieList = cookieStore.getCookies();
    for (Cookie cookie : cookieList) {
        if (cookie.getName().equals("auth_token")) {
            return cookie.getValue();
        }
    }

    return null;
}