开发者社区> 问答> 正文

(OSSJAVASDK1.2.3)NotImplemented错误无法分析问题了,求救了。

以下为异常:


正在上传...
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;
    }















展开
收起
正武 2014-11-01 00:35:12 8550 0
1 条回答
写回答
取消 提交回答
  • Re(OSSJAVASDK1.2.3)NotImplemented错误无法分析问题了,求救了。
    uploadFile()是如何实现的?是否增加了如下一些http header?
       If-Modified-Since
       If-Unmodified-Since
       If-Match
       If-None-Match
    2014-11-03 09:11:01
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
美团 crash 监控分析系统优化之路:crash 率从千分位到万分位 立即下载
如何完成一份像样的互联网金融APP安全检测报告 立即下载
一起来试验 保险箱的脆弱面 立即下载