我正在尝试使用AWS Api设置多个对象的内容类型,并向它们添加’content-encoding:gzip’标头.这是我这样做的代码:
for (S3ObjectSummary summary : objs.getObjectSummaries() )
{
String key = summary.getKey();
if (! key.endsWith(".gz"))
continue;
ObjectMetadata metadata = new ObjectMetadata();
metadata.addUserMetadata("Content-Encoding", "gzip");
metadata.addUserMetadata("Content-Type", "application/x-gzip");
final CopyObjectRequest request = new CopyObjectRequest(bucket, key, bucket, key)
.withSourceBucketName( bucket )
.withSourceKey(key)
.withNewObjectMetadata(metadata);
s3.copyObject(request);
}
但是,当我运行此命令时,结果如下:
如您所见,前缀x-amz-meta已添加到我的自定义标头中,并且它们是小写的.内容类型标头被忽略,而是将www / form-encoded作为标头.
我该怎么做才能使其接受我的标头值?