當前位置: 首頁>>代碼示例>>Java>>正文


Java AsyncHttpClient.addHeader方法代碼示例

本文整理匯總了Java中com.loopj.android.http.AsyncHttpClient.addHeader方法的典型用法代碼示例。如果您正苦於以下問題:Java AsyncHttpClient.addHeader方法的具體用法?Java AsyncHttpClient.addHeader怎麽用?Java AsyncHttpClient.addHeader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.loopj.android.http.AsyncHttpClient的用法示例。


在下文中一共展示了AsyncHttpClient.addHeader方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setHttpClient

import com.loopj.android.http.AsyncHttpClient; //導入方法依賴的package包/類
public static void setHttpClient(AsyncHttpClient c, Application application) {
    c.addHeader("Accept-Language", Locale.getDefault().toString());
    c.addHeader("Host", HOST);
    c.addHeader("Connection", "Keep-Alive");
    //noinspection deprecation
    c.getHttpClient().getParams()
            .setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true);
    // Set AppToken
    c.addHeader("AppToken", Verifier.getPrivateToken(application));
    //c.addHeader("AppToken", "123456");
    // setUserAgent
    c.setUserAgent(ApiClientHelper.getUserAgent(AppContext.getInstance()));
    CLIENT = c;
    initSSL(CLIENT);
    initSSL(API.mClient);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:17,代碼來源:ApiHttpClient.java

示例2: init

import com.loopj.android.http.AsyncHttpClient; //導入方法依賴的package包/類
private static AsyncHttpClient init() {
	AsyncHttpClient client = new AsyncHttpClient();
	client.addHeader("Connection", "Keep-Alive");
	client.setEnableRedirects(true, true, true);

	client.setTimeout(8 * 1000);
	return client;
}
 
開發者ID:hearsilent,項目名稱:AmazingAvatar,代碼行數:9,代碼來源:NetworkHelper.java

示例3: addBehaviors

import com.loopj.android.http.AsyncHttpClient; //導入方法依賴的package包/類
public static void addBehaviors(String json, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams("json", json);
    AsyncHttpClient client = new AsyncHttpClient();
    client.addHeader("passcode", BuildConfig.VIOLET_PASSCODE);
    client.post(URL, params, handler);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:7,代碼來源:API.java

示例4: goMap

import com.loopj.android.http.AsyncHttpClient; //導入方法依賴的package包/類
public void goMap(View v) {

        ArrayList <Friend>participants = new ArrayList<Friend>();
        ArrayList<String> types = new ArrayList<String>();

        if(cafeclick.check) {
            types.add("cafe");
        }
        if(movieclick.check) {
            types.add("movie_theater");
        }
        if(subwayclick.check) {
            types.add("subway_station");
        }
        if(shoppingclick.check) {
            types.add("shopping_mall");
        }
        if(restaurantclick.check) {
            types.add("restaurant");
        }

        for (int i = 0; i < friends.size(); i++) {
            if (friends.get(i).check) {
                participants.add(friends.get(i));
            }
        }
        if(types.size()==0||participants.size()==0) {
            if (types.size() == 0) {
                Toast.makeText(this, "Please select the place types", Toast.LENGTH_SHORT).show();
            }
            if (participants.size() == 0) {
                Toast.makeText(this, "Please select the friends", Toast.LENGTH_SHORT).show();
            }
        }
        else {
            AsyncHttpClient client = new AsyncHttpClient();
            client.addHeader("Authorization", "Bearer " + appToken);

            HttpClientHelper helper = new HttpClientHelper(client);
            helper.getPerfectPlace(types, participants, this);
        }
    }
 
開發者ID:ChristopherJdL,項目名稱:wheretomeet-android,代碼行數:43,代碼來源:FriendsActivity.java


注:本文中的com.loopj.android.http.AsyncHttpClient.addHeader方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。