| | |
| | | client = new OSSClient(properties.getEndpoint(), credentialProvider, configuration); |
| | | createBucket(); |
| | | } catch (Exception e) { |
| | | throw new OssException("阿里云存储配置错误! 请检查系统配置!"); |
| | | throw new OssException("阿里云存储配置错误! 请检查系统配置:[" + e.getMessage() + "]"); |
| | | } |
| | | } |
| | | |
| | |
| | | createBucketRequest.setCannedACL(CannedAccessControlList.PublicRead); |
| | | client.createBucket(createBucketRequest); |
| | | } catch (Exception e) { |
| | | throw new OssException("创建Bucket失败, 请核对阿里云配置信息"); |
| | | throw new OssException("创建Bucket失败, 请核对阿里云配置信息:[" + e.getMessage() + "]"); |
| | | } |
| | | } |
| | | |
| | |
| | | metadata.setContentType(contentType); |
| | | client.putObject(new PutObjectRequest(properties.getBucketName(), path, inputStream, metadata)); |
| | | } catch (Exception e) { |
| | | throw new OssException("上传文件失败,请检查阿里云配置信息"); |
| | | throw new OssException("上传文件失败,请检查阿里云配置信息:[" + e.getMessage() + "]"); |
| | | } |
| | | return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path); |
| | | } |
| | |
| | | try { |
| | | client.deleteObject(properties.getBucketName(), path); |
| | | } catch (Exception e) { |
| | | throw new OssException("上传文件失败,请检查阿里云配置信息"); |
| | | throw new OssException("上传文件失败,请检查阿里云配置信息:[" + e.getMessage() + "]"); |
| | | } |
| | | } |
| | | |
| | |
| | | .build(); |
| | | createBucket(); |
| | | } catch (Exception e) { |
| | | throw new OssException("Minio存储配置错误! 请检查系统配置!"); |
| | | throw new OssException("Minio存储配置错误! 请检查系统配置:[" + e.getMessage() + "]"); |
| | | } |
| | | } |
| | | |
| | |
| | | .config(getPolicy(bucketName, PolicyType.READ)) |
| | | .build()); |
| | | } catch (Exception e) { |
| | | throw new OssException("创建Bucket失败, 请核对Minio配置信息"); |
| | | throw new OssException("创建Bucket失败, 请核对Minio配置信息:[" + e.getMessage() + "]"); |
| | | } |
| | | } |
| | | |
| | |
| | | .stream(inputStream, inputStream.available(), -1) |
| | | .build()); |
| | | } catch (Exception e) { |
| | | throw new OssException("上传文件失败,请核对Minio配置信息"); |
| | | throw new OssException("上传文件失败,请核对Minio配置信息:[" + e.getMessage() + "]"); |
| | | } |
| | | return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path); |
| | | } |
| | |
| | | client = new COSClient(credentials, clientConfig); |
| | | createBucket(); |
| | | } catch (Exception e) { |
| | | throw new OssException("腾讯云存储配置错误! 请检查系统配置!"); |
| | | throw new OssException("腾讯云存储配置错误! 请检查系统配置:[" + e.getMessage() + "]"); |
| | | } |
| | | } |
| | | |
| | |
| | | createBucketRequest.setCannedAcl(CannedAccessControlList.PublicRead); |
| | | client.createBucket(createBucketRequest); |
| | | } catch (Exception e) { |
| | | throw new OssException("创建Bucket失败, 请核对腾讯云配置信息"); |
| | | throw new OssException("创建Bucket失败, 请核对腾讯云配置信息:[" + e.getMessage() + "]"); |
| | | } |
| | | } |
| | | |
| | |
| | | metadata.setContentType(contentType); |
| | | client.putObject(new PutObjectRequest(properties.getBucketName(), path, inputStream, metadata)); |
| | | } catch (Exception e) { |
| | | throw new OssException("上传文件失败,请检查腾讯云配置信息"); |
| | | throw new OssException("上传文件失败,请检查腾讯云配置信息:[" + e.getMessage() + "]"); |
| | | } |
| | | return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path); |
| | | } |
| | |
| | | try { |
| | | client.deleteObject(new DeleteObjectRequest(properties.getBucketName(), path)); |
| | | } catch (Exception e) { |
| | | throw new OssException("上传文件失败,请检腾讯云查配置信息"); |
| | | throw new OssException("上传文件失败,请检腾讯云查配置信息:[" + e.getMessage() + "]"); |
| | | } |
| | | } |
| | | |
| | |
| | | bucketManager.createBucket(bucketName, properties.getRegion()); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new OssException("七牛云存储配置错误! 请检查系统配置!"); |
| | | throw new OssException("七牛云存储配置错误! 请检查系统配置:[" + e.getMessage() + "]"); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | bucketManager.createBucket(bucketName, properties.getRegion()); |
| | | } catch (Exception e) { |
| | | throw new OssException("创建Bucket失败, 请核对七牛云配置信息"); |
| | | throw new OssException("创建Bucket失败, 请核对七牛云配置信息:[" + e.getMessage() + "]"); |
| | | } |
| | | } |
| | | |
| | |
| | | throw new RuntimeException("上传七牛出错:" + res.toString()); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new OssException("上传文件失败,请核对七牛配置信息"); |
| | | throw new OssException("上传文件失败,请核对七牛配置信息:[" + e.getMessage() + "]"); |
| | | } |
| | | return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path); |
| | | } |