qingstor / qingstor-sdk-java Goto Github PK
View Code? Open in Web Editor NEWThe official QingStor SDK for the Java programming language.
License: Apache License 2.0
The official QingStor SDK for the Java programming language.
License: Apache License 2.0
分段上传问题:
1.uploadMultipartinput.setContentLength(size)
必须调用,否则会出现错误
Exception in thread "main" java.lang.NumberFormatException: For input string: "null"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
at com.qingstor.sdk.request.QSOkHttpRequestClient.buildStorMultiUpload(QSOkHttpRequestClient.java:349)
at com.qingstor.sdk.request.QSRequest.buildRequest(QSRequest.java:157)
at com.qingstor.sdk.request.QSRequest.sendApiRequest(QSRequest.java:100)
at com.qingstor.sdk.service.Bucket.uploadMultipart(Bucket.java:3264)
且size的值可以任意定义(上限未测试,下限4M貌似没用):
Dec 07, 2016 2:52:43 PM com.qingstor.sdk.request.QSOkHttpRequestClient requestAction
SEVERE: unexpected end of stream
com.qingstor.sdk.exception.QSException: null; Action : null; Error Code: 0; Error Message: null)
at com.qingstor.sdk.request.QSOkHttpRequestClient.requestAction(QSOkHttpRequestClient.java:159)
at com.qingstor.sdk.request.QSRequest.sendApiRequest(QSRequest.java:102)
at com.qingstor.sdk.service.Bucket.uploadMultipart(Bucket.java:3264)
at Main.main(Main.java:404)
上传图片测试结果:图片内容未丢失。通过Head Object得到的Object的size正常。通过Get Bucket Statisticsbucket得到的bucket的空间占用比正常size小23473(byte)。
`
关于分段上传的一些疑惑:未测试实际上传的内容,但是对与分段上传的机制存在疑惑(忽略上诉问题)。分段上传允许设置inputfile和inputstream,应该是把分段过程交给sdk处理,但是仅要求设置contentlength,难以实现分段效果(缺少一个contentoffset),这还要开发者自己来进行分段。
The first line's code of the todouble function in java-sdk-utils-qsjsonutils which is a if statement may has a error.The second condition may be labelDatas.Length <= i rather than labelDatas.Length >= i.Because it's for list's overflow.
Bucket API —— PUT Bucket External Mirror 遇到了问题
下面是测试代码与输出
try {
PutBucketExternalMirrorInput input = new PutBucketExternalMirrorInput();
input.setSourceSite("http://example.com:80/image/");
PutBucketExternalMirrorOutput output = bucket.putExternalMirror(input);
System.out.println(output.getStatueCode()+":"+output.getMessage());
bucket.putExternalMirrorAsync(null, new ResponseCallBack<Bucket.PutBucketExternalMirrorOutput>() {
@Override
public void onAPIResponse(PutBucketExternalMirrorOutput output) throws QSException {
// TODO Auto-generated method stub
System.out.println(output.getStatueCode()+":"+output.getMessage());
}
});
} catch (QSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
400:The request body format is invalid.
10000:SourceSite is required in PutBucketExternalMirrorInput
不知道是我代码写的不对还是 SDK 有问题
如题
EvnContext evn = new EvnContext(ACCESS_KEY_ID, SECRET_ACCESS_KEY);
QingStor storService = new QingStor(evn);
Bucket.PutObjectInput input = new Bucket.PutObjectInput();
URLConnection connection =new URL(IMAGE_URL).openConnection();
InputStream inputStream = connection.getInputStream();
int len = connection.getContentLength();
input.setBodyInputStream(inputStream);
input.setContentType("image/jpeg");
input.setContentLength(len);
storService.getBucket(BUCKET_NAME).putObject(IMAGE_NAME, input);
小图片上传成功,大于几十k的图片都报错...
SEVERE: unexpected end of stream com.qingstor.sdk.exception.QSException: Error Code: 0; Error Message: unexpected end of stream at com.qingstor.sdk.request.QSOkHttpRequestClient.requestAction(QSOkHttpRequestClient.java:160) at com.qingstor.sdk.request.QSRequest.sendApiRequest(QSRequest.java:109) at com.qingstor.sdk.service.Bucket.putObject(Bucket.java:3330) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
一混淆就报错!!!一混淆就报错!!!一混淆就报错!!!
不说了 很不幸我已经接好了
我去改成Android SDK 去了
Since 2.2.9 only the fat jar is published to maven public repository. And it cause the conflict between the classes included into fat jar and third party jar from other vendor.
It cost me the whole afternoon to find the root cause.
目前在私服里还得自己上传
既然release了。
问题:“Code Snippet"中的"Create API server"中moreEvn.setHost("privatestor.com")
使用该配置会导致调用API时出现错误:SEVERE: privatestor.com: unknown error
修改意见:修改参数
moreEvn.setHost("qingstor.com")
问题:"Code Snippet"中的"Create API server"中moreEvn.setPort(443)
参数类型错误
修改意见:修改参数为String类型
moreEvn.setPort("443")
问题:文档中"Code Snippet"中的"Initialize the QingStor service with a configuration"中QingStor storService = new QingStor(evn, bucketName);
没有对应的构造函数。
修改意见:使用正确的构造函数
QingStor storService = new QingStor(evn);
或
String zoneName = "pek3a";
QingStor storService = new QingStor(evn, zoneName);
如果使用了一个异步接口,即时回调已经被调用,线程(程序)也不会停止。
建议当回调被调用后关闭停止连接池线程。(或者给用户提示:如果使用了异步API需要手动确认终止程序。)
https://github.com/qingstor/qingstor-sdk-java/blob/master/docs/guide_zh.md
您可以在这里看到包含完整包结构的SDK文档:github pages。
github pages。指向的连接失效了
Add a thread count parameter,
Supports multi-threaded upload sharding.
An elegant approach to deal with genrating url of ImageProcessClient.
Sort out the processing path, common abstraction with no special treatment.
获取对象下载链接,能否提供短链接呢,测试上传中文文件,生成的链接中有3次转译objectName的拼装,实在太长了……
下面是具体的问题:
owner
的name
和 默认ACLGrantee
的name
都是 ""
。input.setContentLength(size)
好像没有什么用处。当objectName设为""
时返回409:The bucket you are trying to create already exists.
这个接口不应该有这样的功能吧。""
时返回409:The bucket is not empty.
这个接口不应该有这样的功能吧。当object不存在时返回与删除成功同样的结果,无法判断。A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.