LogIntercep
来源:互联网 发布:新手可以做淘宝代销吗 编辑:程序博客网 时间:2024/06/14 02:02
public class LogIntercep implements Interceptor {
private static final String TAG = “LogIntercep”;
@Override
public okhttp3.Response intercept(Chain chain) throws IOException {
Request request = chain.request();
Log.e(TAG,”————————-begin—————————”);
Log.v(TAG, “request:” + request.toString());
long t1 = System.nanoTime();
okhttp3.Response response = chain.proceed(chain.request());
long t2 = System.nanoTime();
Log.v(TAG, String.format(Locale.getDefault(), “Received response for %s in %.1fms%n%s”,
response.request().url(), (t2 - t1) / 1e6d, response.headers()));
okhttp3.MediaType mediaType = response.body().contentType();
String content = response.body().string();
Log.v(TAG, “response body:” + content);
Log.e(TAG,”————————–end————————–”);
return response.newBuilder()
.body(okhttp3.ResponseBody.create(mediaType, content))
.build();
}
}
- LogIntercep
- apache Shiro学习笔记(三)Authorization
- websocket与struts2冲突
- iOS 11开发教程(十三)iOS11应用编辑界面添加视图
- jsp自定义行数 表格填充
- 解决方案:python version 2.7 required,which was not found in
- LogIntercep
- 先知创新大会议题第二弹:你不知道的网络安全黑科技
- maven install 失败
- 滚动的数字
- 基于Django的微信公众号开发(2) -- 在sae添加第三方包
- 判断客户端的请求是Ajax请求的方法
- maven(八)继承和聚合
- 听说中国最顶尖的原创安全技术都聚集在此了
- 设计模式-建造者模式