本文整理匯總了Java中com.loopj.android.http.AsyncHttpClient.setEnableRedirects方法的典型用法代碼示例。如果您正苦於以下問題:Java AsyncHttpClient.setEnableRedirects方法的具體用法?Java AsyncHttpClient.setEnableRedirects怎麽用?Java AsyncHttpClient.setEnableRedirects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.loopj.android.http.AsyncHttpClient
的用法示例。
在下文中一共展示了AsyncHttpClient.setEnableRedirects方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAsyncHttpClient
import com.loopj.android.http.AsyncHttpClient; //導入方法依賴的package包/類
@Override
public AsyncHttpClient getAsyncHttpClient() {
AsyncHttpClient ahc = super.getAsyncHttpClient();
HttpClient client = ahc.getHttpClient();
if (client instanceof DefaultHttpClient) {
Toast.makeText(this,
String.format("redirects: %b\nrelative redirects: %b\ncircular redirects: %b",
enableRedirects, enableRelativeRedirects, enableCircularRedirects),
Toast.LENGTH_SHORT
).show();
ahc.setEnableRedirects(enableRedirects, enableRelativeRedirects, enableCircularRedirects);
}
return ahc;
}
示例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: executeSample
import com.loopj.android.http.AsyncHttpClient; //導入方法依賴的package包/類
@Override
public RequestHandle executeSample(AsyncHttpClient client, String URL, Header[] headers, HttpEntity entity, ResponseHandlerInterface responseHandler) {
client.setEnableRedirects(true);
return client.get(this, URL, headers, null, responseHandler);
}