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


Java CallServerInterceptor類代碼示例

本文整理匯總了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);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:18,代碼來源:RealCall.java

示例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);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:20,代碼來源:RealCall.java

示例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);
}
 
開發者ID:RunningTheSnail,項目名稱:Okhttp,代碼行數:24,代碼來源:RealCall.java

示例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);
}
 
開發者ID:why168,項目名稱:AndroidProjects,代碼行數:24,代碼來源:RealCall.java


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