Java 类com.android.volley.toolbox.HttpClientStack 实例源码

项目:Wardrobe_app    文件:ImageLoader.java   
private static RequestQueue newRequestQueue(Context context) {

        // On HC+ use HurlStack which is based on HttpURLConnection. Otherwise fall back on
        // AndroidHttpClient (based on Apache DefaultHttpClient) which should no longer be used
        // on newer platform versions where HttpURLConnection is simply better.
        Network network = new BasicNetwork(
                UIUtils.hasHoneycomb() ?
                        new HurlStack() :
                        new HttpClientStack(AndroidHttpClient.newInstance(
                                NetUtils.getUserAgent(context))));

        Cache cache = new DiskBasedCache(getDiskCacheDir(context, CACHE_DIR));
        RequestQueue queue = new RequestQueue(cache, network);
        queue.start();
        return queue;
    }
项目:iosched2013    文件:ImageLoader.java   
private static RequestQueue newRequestQueue(Context context) {

        // On HC+ use HurlStack which is based on HttpURLConnection. Otherwise fall back on
        // AndroidHttpClient (based on Apache DefaultHttpClient) which should no longer be used
        // on newer platform versions where HttpURLConnection is simply better.
        Network network = new BasicNetwork(
                UIUtils.hasHoneycomb() ?
                        new HurlStack() :
                        new HttpClientStack(AndroidHttpClient.newInstance(
                                NetUtils.getUserAgent(context))));

        Cache cache = new DiskBasedCache(getDiskCacheDir(context, CACHE_DIR));
        RequestQueue queue = new RequestQueue(cache, network);
        queue.start();
        return queue;
    }
项目:odoo-work    文件:OdooWrapper.java   
public OdooWrapper(Context context, String baseURL) {
    serverURL = stripURL(baseURL);
    gson = new Gson();
    responseQueue = new OdooResponseQueue();
    requestQueue = Volley.newRequestQueue(context,
            new HttpClientStack(OdooSafeClient.getSafeClient(true)));
}
项目:odoo-follow-up    文件:OdooWrapper.java   
public OdooWrapper(Context context, String baseURL) {
    serverURL = stripURL(baseURL);
    gson = new Gson();
    responseQueue = new OdooResponseQueue();
    requestQueue = Volley.newRequestQueue(context,
            new HttpClientStack(OdooSafeClient.getSafeClient(true)));
}
项目:android-discourse    文件:ImageLoader.java   
private static RequestQueue newRequestQueue(Context context) {

        // On HC+ use HurlStack which is based on HttpURLConnection. Otherwise fall back on
        // AndroidHttpClient (based on Apache DefaultHttpClient) which should no longer be used
        // on newer platform versions where HttpURLConnection is simply better.
        Network network = new BasicNetwork(Utils.hasHoneycomb() ? new HurlStack() : new HttpClientStack(AndroidHttpClient.newInstance(Utils.getUserAgent(context))));

        Cache cache = new DiskBasedCache(getDiskCacheDir(context, CACHE_DIR), DEFAULT_DISK_USAGE_BYTES);
        RequestQueue queue = new RequestQueue(cache, network);
        queue.start();
        return queue;
    }
项目:VolleyCookie    文件:AppController.java   
public RequestQueue getRequestQueue() {
//        if (mRequestQueue == null) {
//            mRequestQueue = Volley.newRequestQueue(getApplicationContext());
//        }
//
//        return mRequestQueue;
        if (mRequestQueue == null) {
            httpClient = HttpClients.custom()
                    .setConnectionManager(new PoolingHttpClientConnectionManager())
                    .setDefaultCookieStore(new PersistentCookieStore(getApplicationContext()))
                    .build();
            mRequestQueue = Volley.newRequestQueue(getApplicationContext(), new HttpClientStack(httpClient));
        }
        return mRequestQueue;
    }
项目:MALFriends    文件:RequestHelper.java   
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
private static RequestQueue getRequestQueue() {
    if (mRequestQueue == null) {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD) {
            DefaultHttpClient httpClient = new DefaultHttpClient();
            httpClient.setRedirectHandler(new DefaultRedirectHandler() {
                @Override
                public boolean isRedirectRequested(HttpResponse response,
                        HttpContext context) {
                    boolean isRedirect = super.isRedirectRequested(
                            response, context);
                    if (!isRedirect) {
                        int responseCode = response.getStatusLine()
                                .getStatusCode();
                        if (responseCode == 301 || responseCode == 302) {
                            return true;
                        }
                    }
                    return isRedirect;
                }
            });
            httpClient.setCookieStore(new BasicCookieStore());
            HttpStack httpStack = new HttpClientStack(httpClient);
            mRequestQueue = Volley.newRequestQueue(MALFriends.getInstance()
                    .getApplicationContext(), httpStack);
        } else {
            HttpURLConnection.setFollowRedirects(true);
            CookieManager manager = new CookieManager(null,
                    CookiePolicy.ACCEPT_ALL);
            CookieHandler.setDefault(manager);
            mRequestQueue = Volley.newRequestQueue(MALFriends.getInstance()
                    .getApplicationContext());
        }

    }
    return mRequestQueue;
}
项目:CrossBow    文件:HttpStackSelector.java   
public static HttpStack createStack() {
    if(hasOkHttp()) {
        OkHttpClient okHttpClient = new OkHttpClient();
        VolleyLog.d("OkHttp found, using okhttp for http stack");
        return new OkHttpStack(okHttpClient);
    }
    else if (useHttpClient()){
        VolleyLog.d("Android version is older than Gingerbread (API 9), using HttpClient");
        return new HttpClientStack(AndroidHttpClient.newInstance(USER_AGENT));
    }
    else {
        VolleyLog.d("Using Default HttpUrlConnection");
        return new HurlStack();
    }
}
项目:SpeedReading    文件:ImportGutenbergTop100Activity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    setContentView(R.layout.activity_import_gutenberg_top_100);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    client = new DefaultHttpClient();
    queue = Volley.newRequestQueue(this, new HttpClientStack(client));

    loadTop100List();
}
项目:CustomViews    文件:App.java   
@Override
public void onCreate() {
    super.onCreate();

    sRequestQueue = Volley.newRequestQueue(
            getApplicationContext(),
            new HttpClientStack(AndroidHttpClient
                    .newInstance("com.imbryk.demo/0")));
    sImageLoader = new ImageLoader(sRequestQueue, new BitmapLruCache());
}
项目:android-project-template    文件:VolleyHelperFactory.java   
@Override
public HttpStack createHttpStack(@NonNull final Context context) {
    return new HttpClientStack(createHttpClient(context));
}