七牛 java sdk, fetch接口报错
Messages:
Found interface com.squareup.okhttp.Connection, but class was expected
File: com/qiniu/http/Client.java
Line number: 39
用的未经修改的fetch接口,执行到Client类39行报错,想问下这个接口有问题吗,默认的用不了吗,一定要改吗,
查到http://segmentfault.com/q/1010000000455177抓取资源(fetch)的java示例代码
里面有改过的fetch接口,可以我想改,有些类找不到jar包,无法重新编译,特别是这个CallRet类
public Client() {
Dispatcher dispatcher = new Dispatcher();
dispatcher.setMaxRequests(64);
dispatcher.setMaxRequestsPerHost(16);
ConnectionPool connectionPool = new ConnectionPool(32, 5 * 60 * 1000);
httpClient = new OkHttpClient();
httpClient.setDispatcher(dispatcher);
httpClient.setConnectionPool(connectionPool);
httpClient.networkInterceptors().add(new Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(Chain chain) throws IOException {
Request request = chain.request();
com.squareup.okhttp.Response response = chain.proceed(request);
IpTag tag = (IpTag) request.tag();
39行 String ip = chain.connection().getSocket().getRemoteSocketAddress().toString();
tag.ip = ip;
return response;
}
});
httpClient.setConnectTimeout(Config.CONNECT_TIMEOUT, TimeUnit.SECONDS);
httpClient.setReadTimeout(Config.RESPONSE_TIMEOUT, TimeUnit.SECONDS);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论