okhttp的封装

使用单例模式返回数据 1.构造私有化 使Client唯一 节省资源 2.懒汉模式 判断是否为空 为空上锁 在此非判断是否为空 为空New对象 双重锁 3.写对应的方法 例如 get post downLoad upLoad 添加log拦截器 添加token拦截器 intercept:Toaken拦截  httpLoggingInterceptor Log拦截 addInterceptor添加拦截
相关文章
相关标签/搜索