OkHttp拦截器
2017-09-26 15:05
204 查看
一个类轻松搞定
public class ok {OkHttpClient client = new OkHttpClient();String run(String url) throws IOException {Request request = new Request.Builder().url(url).build();Response response = client.newCall(request).execute();return response.body().string();}//拦截器public interface Interceptor {Response intercept(Chain chain) throws IOException;interface Chain {Request request();Response proceed(Request request) throws IOException;/*** Returns the connection the request will be executed on. This is only available in the chains* of network interceptors; for application interceptors this is always null.*/@NullableConnection connection();}}}
相关文章推荐
- OkhttpPost加拦截器
- 封装Okhttp3Util(拦截器)
- OkHttp3 拦截器 封装公共参数
- OKHTTP拦截器的工具类
- Android的OkHttp包中的HTTP拦截器Interceptor用法示例
- 熟悉使用okhttp和拦截器使用
- OkHttp3拦截器的使用
- OkHttp框架加拦截器
- OkHttp框架中拦截器设计精髓之责任链模式
- OkHttp - 拦截器(Interceptor) 重新定义请求 Request
- okHttp拦截器放在doGet和doPost请求中
- Android OkHttp 源码解析 (五) CacheInterceptor 缓存拦截器
- okhttp拦截器
- OkHttp 源码解析(3) Interceptor 拦截器
- android RxJava+Retrofit2.0 OkHttp添加日志拦截器和设置请求头
- OkHttp基本使用(五)拦截器
- OkHttp使用(四)拦截器
- Android OkHttp官方Wiki之Interceptors拦截器
- OkHttp完全解析(六)拦截器
- OkHttp拦截器的简单使用