com.android.volley.toolbox.HttpClientStack Java Examples

The following examples show how to use com.android.volley.toolbox.HttpClientStack. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImageLoader.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
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;
    }
 
Example #2
Source File: OdooWrapper.java    From framework with GNU Affero General Public License v3.0 5 votes vote down vote up
public OdooWrapper(Context context, String baseURL) {
    serverURL = stripURL(baseURL);
    gson = new Gson();
    responseQueue = new OdooResponseQueue();
    requestQueue = Volley.newRequestQueue(context,
            new HttpClientStack(OdooSafeClient.getSafeClient(true)));
}
 
Example #3
Source File: HttpStackSelector.java    From CrossBow with Apache License 2.0 5 votes vote down vote up
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();
    }
}