发表于: 2017-05-15 23:03:30
1 1414
今天完成的事:
1、参照金山云的API文档上传图片(未成功)
String imagpath="D:/aaa.jpg";
Ks3 client = new Ks3Client("AKLTQn1dycxTSa-cOuPeYI-6Jw","ODnIc74pQLDdoNNI9uGGTVagiznd9oCPlWwdTj8VT+8ZihIijFK/+f+YWkEpoj3G9g==");
PutObjectRequest request = new PutObjectRequest("kinspace-wuzhiyong",
"testImage", new File("D:/aaa.jpg"));
//上传一个公开文件
request.setCannedAcl(CannedAccessControlList.PublicReadWrite);
client.putObject(request);
Exception in thread "main" com.ksyun.ks3.exception.client.CallRemoteFailException: java.net.SocketException: Connection reset by peer: socket write error
at com.ksyun.ks3.http.Ks3CoreController.doExecute(Ks3CoreController.java:138)
at com.ksyun.ks3.http.Ks3CoreController.execute(Ks3CoreController.java:91)
at com.ksyun.ks3.service.Ks3Client.putObject(Ks3Client.java:492)
at com.jnshu.controller.HomeController.main(HomeController.java:69)
Caused by: java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
at org.apache.http.impl.io.SessionOutputBufferImpl.streamWrite(SessionOutputBufferImpl.java:126)
at org.apache.http.impl.io.SessionOutputBufferImpl.flushBuffer(SessionOutputBufferImpl.java:138)
at org.apache.http.impl.io.SessionOutputBufferImpl.write(SessionOutputBufferImpl.java:169)
at org.apache.http.impl.io.ContentLengthOutputStream.write(ContentLengthOutputStream.java:115)
at org.apache.http.entity.InputStreamEntity.writeTo(InputStreamEntity.java:146)
at com.ksyun.ks3.http.RepeatableInputStreamRequestEntity.writeTo(RepeatableInputStreamRequestEntity.java:68)
at org.apache.http.impl.DefaultBHttpClientConnection.sendRequestEntity(DefaultBHttpClientConnection.java:158)
at org.apache.http.impl.conn.CPoolProxy.sendRequestEntity(CPoolProxy.java:162)
at org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:237)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:122)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at com.ksyun.ks3.http.Ks3CoreController.requestKs3(Ks3CoreController.java:239)
at com.ksyun.ks3.http.Ks3CoreController.doExecute(Ks3CoreController.java:136)
... 3 more
明天计划的事:问金山的客服,不行的话,只能用短信和邮箱
遇到的问题:
1、感觉金山云的API说明文档让人摸不着头脑,说的很不清楚,没有提供一个demo给新人参照,觉得这点很不合理。而且官网上的和他提供的GitHub上面的文档有差异,更奇怪的事竟然百度不到一篇关于金山云图片API的demo,操作指南指的让你找不到内容。 浪费了一整天的时间。
收获:无
总结:引用同门一句话 用的认真 伤的很深。
评论