etag java_Java HttpHeaders.setETag方法代码示例

import org.springframework.http.HttpHeaders; //导入方法依赖的package包/类

/**

* Adds an object to a bucket accepting encryption headers.

*

* http://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadUploadPart.html

*

* @param bucketName the Bucket in which to store the file in.

* @param uploadId id of the upload. Has to match all other part's uploads.

* @param partNumber number of the part to upload.

* @param encryption Defines the encryption mode.

* @param kmsKeyId Defines the KMS key id.

* @param request {@link HttpServletRequest} of this request.

*

* @return the etag of the uploaded part.

*

* @throws IOException in case of an error.

*/

@RequestMapping(

value = "/{bucketName:.+}/**",

params = {"uploadId", "partNumber"},

headers = {

NOT_COPY_SOURCE,

NOT_COPY_SOURCE_RANGE,

SERVER_SIDE_ENCRYPTION

},

method = RequestMethod.PUT)

public ResponseEntity putObjectPart(@PathVariable final String bucketName,

@RequestParam final String uploadId,

@RequestParam final String partNumber,

@RequestHeader(value = SERVER_SIDE_ENCRYPTION) final String encryption,

@RequestHeader(

value = SERVER_SIDE_ENCRYPTION_AWS_KMS_KEYID,

required = false) final String kmsKeyId,

final HttpServletRequest request) throws IOException {

final String filename = filenameFrom(bucketName, request);

final String etag = fileStore.putPart(bucketName,

filename,

uploadId,

partNumber,

request.getInputStream(),

isV4SigningEnabled(request));

final HttpHeaders responseHeaders = new HttpHeaders();

final String quotedEtag = "\"" + etag + "\"";

responseHeaders.setETag(quotedEtag);

return new ResponseEntity<>(responseHeaders, HttpStatus.CREATED);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值