java - OkHttp的Application Interceptors和Network Interceptors具体区别是?
PHPz
PHPz 2017-04-17 15:46:21
0
0
341

Choosing between application and network interceptors

Each interceptor chain has relative merits.

Application interceptors

  • Don't need to worry about intermediate responses like redirects and retries.

  • Are always invoked once, even if the HTTP response is served from the cache.

  • Observe the application's original intent. Unconcerned with OkHttp-injected headers like If-None-Match.

  • Permitted to short-circuit and not call Chain.proceed().

  • Permitted to retry and make multiple calls to Chain.proceed().

Network Interceptors

  • Able to operate on intermediate responses like redirects and retries.

  • Not invoked for cached responses that short-circuit the network.

  • Observe the data just as it will be transmitted over the network.

  • Access to the Connection that carries the request.

理解的不是很透彻,希望大神解答

PHPz
PHPz

学习是最好的投资!

全部回覆(0)
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!