以下为异常:
正在上传...
Exception in thread "main" [Error Code]:NotImplemented, [Message]:A header you provided implies functionality that is not implemented.
at com.aliyun.openservices.oss.internal.OSSExceptionFactory.create(OSSExceptionFactory.java:15)
at com.aliyun.openservices.oss.internal.OSSErrorResponseHandler.handle(OSSErrorResponseHandler.java:39)
at com.aliyun.common.comm.ServiceClient.handleResponse(ServiceClient.java:284)
at com.aliyun.common.comm.ServiceClient.sendRequestImpl(ServiceClient.java:177)
at com.aliyun.common.comm.ServiceClient.sendRequest(ServiceClient.java:136)
at com.aliyun.openservices.oss.internal.OSSOperation.send(OSSOperation.java:60)
at com.aliyun.openservices.oss.internal.OSSObjectOperation.putObject(OSSObjectOperation.java:76)
at com.aliyun.openservices.oss.OSSClient.putObject(OSSClient.java:334)
at com.wehome.ctb.img.helper.OSSObjectHelper.uploadFile(OSSObjectHelper.java:191)
at com.wehome.ctb.img.helper.OSSObjectHelper.uploadDownloadFile(OSSObjectHelper.java:78)
at com.wehome.ctb.img.helper.OSSObjectHelper.main(OSSObjectHelper.java:36)
---------------------------------------------------------------------------华丽分割线-----------------------------------------------------------------
代码介绍:
public static void main(String[] args) throws Exception {
String uploadFilePath = "d:/tmp/src.jpg";
String downloadFilePath = "d:/tmp/src-11.jpg";
try {
System.out.println("正在上传...");
String key = "test1";
uploadDownloadFile(key, uploadFilePath);
System.out.println("正在下载...");
getDownloadFile(key, downloadFilePath);
} finally {
//deleteBucket(client, bucketName);
}
}
public static String uploadDownloadFile(String key, String uploadFilePath)
throws OSSException, ClientException, FileNotFoundException{
OSSClient client = getDownloadClient(ACCESS_ID, ACCESS_KEY);
return uploadFile(client, downloadBucketName, key, uploadFilePath);
}
private static OSSClient downloadClient = null;
private static final String downloadBucketName = "xxxx-image-download";
private static final String downloadEndpoint = "http://image.xxxx.org";
private static OSSClient getDownloadClient(String id, String key){
if(downloadClient == null){
downloadClient = new OSSClient(downloadEndpoint, id, key);
ensureBucket(downloadClient, downloadBucketName);
}
return downloadClient;
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。