title: How to set the content type of an S3 object via the SDK?
body: <p>I'm trying to use AWS Api to set the content type of multiple objects and to add a 'content-encoding: gzip' header to them. Here's my code for doing that:</p>
  
  <pre><code>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);
     }
  </code></pre>
  
  <p>When I run this however, the following is the result:</p>
  
  <p><img src="https://i.stack.imgur.com/VTBt9.png" alt="screenshot"></p>
  
  <p>As you can see, the prefix <code>x-amz-meta</code> was added to my custom headers, and they were lower cased. And the <code>content-type</code> header was ignored, instead it put <code>www/form-encoded</code> as the header.</p>
  
  <p>What can I do it to cause it to accept my header values?</p>