当前位置: 首页>>代码示例>>Java>>正文


Java HttpClientStack类代码示例

本文整理汇总了Java中com.android.volley.toolbox.HttpClientStack的典型用法代码示例。如果您正苦于以下问题:Java HttpClientStack类的具体用法?Java HttpClientStack怎么用?Java HttpClientStack使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HttpClientStack类属于com.android.volley.toolbox包,在下文中一共展示了HttpClientStack类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newRequestQueue

import com.android.volley.toolbox.HttpClientStack; //导入依赖的package包/类
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;
    }
 
开发者ID:BitCypher2014,项目名称:Wardrobe_app,代码行数:17,代码来源:ImageLoader.java

示例2: getRequestQueue

import com.android.volley.toolbox.HttpClientStack; //导入依赖的package包/类
@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;
}
 
开发者ID:DandreX,项目名称:MALFriends,代码行数:38,代码来源:RequestHelper.java

示例3: OdooWrapper

import com.android.volley.toolbox.HttpClientStack; //导入依赖的package包/类
public OdooWrapper(Context context, String baseURL) {
    serverURL = stripURL(baseURL);
    gson = new Gson();
    responseQueue = new OdooResponseQueue();
    requestQueue = Volley.newRequestQueue(context,
            new HttpClientStack(OdooSafeClient.getSafeClient(true)));
}
 
开发者ID:odoo-mobile-intern,项目名称:odoo-work,代码行数:8,代码来源:OdooWrapper.java

示例4: newRequestQueue

import com.android.volley.toolbox.HttpClientStack; //导入依赖的package包/类
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;
    }
 
开发者ID:goodev,项目名称:android-discourse,代码行数:13,代码来源:ImageLoader.java

示例5: getRequestQueue

import com.android.volley.toolbox.HttpClientStack; //导入依赖的package包/类
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;
    }
 
开发者ID:rafaelneiva,项目名称:VolleyCookie,代码行数:16,代码来源:AppController.java

示例6: createStack

import com.android.volley.toolbox.HttpClientStack; //导入依赖的package包/类
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();
    }
}
 
开发者ID:patrick-doyle,项目名称:CrossBow,代码行数:16,代码来源:HttpStackSelector.java

示例7: onCreate

import com.android.volley.toolbox.HttpClientStack; //导入依赖的package包/类
@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();
}
 
开发者ID:richard-mihalovic,项目名称:SpeedReading,代码行数:14,代码来源:ImportGutenbergTop100Activity.java

示例8: onCreate

import com.android.volley.toolbox.HttpClientStack; //导入依赖的package包/类
@Override
public void onCreate() {
	super.onCreate();

	sRequestQueue = Volley.newRequestQueue(
			getApplicationContext(),
			new HttpClientStack(AndroidHttpClient
					.newInstance("com.imbryk.demo/0")));
	sImageLoader = new ImageLoader(sRequestQueue, new BitmapLruCache());
}
 
开发者ID:imbryk,项目名称:CustomViews,代码行数:11,代码来源:App.java

示例9: createHttpStack

import com.android.volley.toolbox.HttpClientStack; //导入依赖的package包/类
@Override
public HttpStack createHttpStack(@NonNull final Context context) {
    return new HttpClientStack(createHttpClient(context));
}
 
开发者ID:lemberg,项目名称:android-project-template,代码行数:5,代码来源:VolleyHelperFactory.java


注:本文中的com.android.volley.toolbox.HttpClientStack类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。