本文整理匯總了Java中okhttp3.internal.http.CallServerInterceptor類的典型用法代碼示例。如果您正苦於以下問題:Java CallServerInterceptor類的具體用法?Java CallServerInterceptor怎麽用?Java CallServerInterceptor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CallServerInterceptor類屬於okhttp3.internal.http包,在下文中一共展示了CallServerInterceptor類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getResponseWithInterceptorChain
import okhttp3.internal.http.CallServerInterceptor; //導入依賴的package包/類
Response getResponseWithInterceptorChain() throws IOException {
// Build a full stack of interceptors.
List<Interceptor> interceptors = new ArrayList<>();
interceptors.addAll(client.interceptors());
interceptors.add(retryAndFollowUpInterceptor);
interceptors.add(new BridgeInterceptor(client.cookieJar()));
interceptors.add(new CacheInterceptor(client.internalCache()));
interceptors.add(new ConnectInterceptor(client));
if (!forWebSocket) {
interceptors.addAll(client.networkInterceptors());
}
interceptors.add(new CallServerInterceptor(forWebSocket));
Interceptor.Chain chain = new RealInterceptorChain(
interceptors, null, null, null, 0, originalRequest);
return chain.proceed(originalRequest);
}
示例2: getResponseWithInterceptorChain
import okhttp3.internal.http.CallServerInterceptor; //導入依賴的package包/類
Response getResponseWithInterceptorChain() throws IOException {
// Build a full stack of interceptors.
List<Interceptor> interceptors = new ArrayList<>();
interceptors.addAll(client.interceptors());
interceptors.add(retryAndFollowUpInterceptor);
interceptors.add(new BridgeInterceptor(client.cookieJar()));
interceptors.add(new CacheInterceptor(client.internalCache()));
interceptors.add(new ConnectInterceptor(client));
if (!forWebSocket) {
interceptors.addAll(client.networkInterceptors());
}
interceptors.add(new CallServerInterceptor(forWebSocket));
Interceptor.Chain chain = new RealInterceptorChain(interceptors, null, null, null, 0,
originalRequest, this, eventListener, client.connectTimeoutMillis(),
client.readTimeoutMillis(), client.writeTimeoutMillis());
return chain.proceed(originalRequest);
}
示例3: getResponseWithInterceptorChain
import okhttp3.internal.http.CallServerInterceptor; //導入依賴的package包/類
private Response getResponseWithInterceptorChain() throws IOException {
// Build a full stack of interceptors.
List<Interceptor> interceptors = new ArrayList<>();
//獲取為OkHttp配置的攔截器
interceptors.addAll(client.interceptors());
//添加重連攔截器
interceptors.add(retryAndFollowUpInterceptor);
//完善Request
//補充各種Header
interceptors.add(new BridgeInterceptor(client.cookieJar()));
//緩存策略攔截器
interceptors.add(new CacheInterceptor(client.internalCache()));
interceptors.add(new ConnectInterceptor(client));
if (!retryAndFollowUpInterceptor.isForWebSocket()) {
//添加NetWork攔截器
interceptors.addAll(client.networkInterceptors());
}
//回調responseCallBack
interceptors.add(new CallServerInterceptor(retryAndFollowUpInterceptor.isForWebSocket()));
Interceptor.Chain chain = new RealInterceptorChain(interceptors, null, null, null, 0, originalRequest);
return chain.proceed(originalRequest);
}
示例4: getResponseWithInterceptorChain
import okhttp3.internal.http.CallServerInterceptor; //導入依賴的package包/類
/**
* 得到響應與攔截器鏈
*
* @return Response
* @throws IOException IOException
*/
Response getResponseWithInterceptorChain() throws IOException {
// Build a full stack of interceptors.
List<Interceptor> interceptors = new ArrayList<>();
interceptors.addAll(client.interceptors());
interceptors.add(retryAndFollowUpInterceptor);
interceptors.add(new BridgeInterceptor(client.cookieJar()));
interceptors.add(new CacheInterceptor(client.internalCache()));
interceptors.add(new ConnectInterceptor(client));
if (!forWebSocket) {
interceptors.addAll(client.networkInterceptors());
}
interceptors.add(new CallServerInterceptor(forWebSocket));
Interceptor.Chain chain = new RealInterceptorChain(
interceptors, null, null, null, 0, originalRequest);
return chain.proceed(originalRequest);
}