本文整理匯總了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);
}
示例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;
}
示例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);
}
示例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);
}
}