本文整理汇总了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);
}