七牛 视频上传 java.net.SocketTimeoutException: timeout? 财富值73

2016-10-17 20:54发布

新手学习做七牛云上传视频的时候 报错如下,麻烦哪位大神抽空帮我检查下、感激不尽:
java.net.SocketTimeoutException: timeout
...
...
...
Caused by: java.net.SocketException: Socket closed
我的代码:
/**

 * 视频上传  * @param filePath  * @return  */ public Map uploadMp4(String filePath){     //密钥配置     Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY);     //mp4重命名     String key = new QNiuTools().getKeyByName("mp4")+".mp4";     System.out.println("key:"+key);      //上传凭证     String upTaken = auth.uploadToken(SCOPE1,key,3600,null,true);     System.out.println("upTaken:"+upTaken);      try {         //创建上传对象         UploadManager uploadManager = new UploadManager();          Map map = new HashMap();          //OkHttpClient client = new OkHttpClient();         //client.setConnectTimeout(5, TimeUnit.MINUTES);         //client.setReadTimeout(5,TimeUnit.MINUTES);         //client.setWriteTimeout(5,TimeUnit.MINUTES);          //调用put方法上传         Response res = uploadManager.put(filePath, key, upTaken);         //uploadManager.put(new File(filePath),key,upTaken);         String fileName = key.substring(key.lastIndexOf("/")+1,key.length()) ;         map.put("fileName",fileName);         map.put("info","http://"+SCOPE_DOMAIN1+"/");         map.put("path",key.substring(0,key.lastIndexOf("/")+1));         System.out.println(map.get("info")+""+key);         System.out.println("===================");         return map;     } catch (QiniuException e) {         e.printStackTrace();     }     return null; } 
友情提示: 问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
0条回答

一周热门 更多>