H5W3
当前位置:H5W3 > 其他技术问题 > 正文

七牛测试地址怎么配置?没有文档呢,是少了什么配置么?

七牛测试地址怎么配置?没有文档呢,报错了,UploadManager怎么知道上传的请求地址?测试地址又是干嘛的?
com.qiniu.common.QiniuException

at com.qiniu.http.Client.send(Client.java:202)
at com.qiniu.http.Client.multipartPost(Client.java:175)
at com.qiniu.http.Client.multipartPost(Client.java:143)
at com.qiniu.storage.FormUploader.upload(FormUploader.java:52)
at com.qiniu.storage.UploadManager.put(UploadManager.java:126)
at com.qiniu.storage.UploadManager.put(UploadManager.java:104)

执行到 Response response= uploadManager.put(data, key, token);时报错,
代码:
public static boolean upLoadFile(byte[] data,String key){

    try {
        System.out.println("######data.length: "+data.length);
        if(data.length==0)throw new RuntimeException("上传文件内容为空");
        UploadManager uploadManager=new UploadManager();
        String token=getUptoken(key);
        Response response= uploadManager.put(data, key, token);
        System.out.println("##########Response: "+response.isOK());
        return true;
    } catch (QiniuException e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
    return false;
}

回答:

1、七牛的上传地址,

https://github.com/qiniu/android-sdk/blob/master/library/src/main/java/com/qiniu/android/common/Zone.java

2、报错可能是由于引用jar版本问题,可参考:https://qiniu.kf5.com/hc/kb/article/112985/

本文地址:H5W3 » 七牛测试地址怎么配置?没有文档呢,是少了什么配置么?

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址