OkHttp
List<Interceptor> interceptors = new ArrayList<>();
interceptors.addAll(client.interceptors());
interceptors.add(new RetryAndFollowUpInterceptor(client));
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, transmitter, null, 0,
originalRequest, this, client.connectTimeoutMillis(),
client.readTimeoutMillis(), client.writeTimeoutMillis());
OkHttp
自定义拦截器和自定义网络拦截器
自定义拦截器
RetryAndFollowUpInterceptor
RetryAndFollowUpInterceptor
BridgeInterceptor
BridgeInterceptor
CacheInterceptor
CacheInterceptor
ConnectInterceptor
ConnectInterceptor
CallServerInterceptor
CallServerInterceptor