Java Code Examples for com.amazonaws.services.s3.model.ObjectMetadata.setContentDisposition()

The following are Jave code examples for showing how to use setContentDisposition() of the com.amazonaws.services.s3.model.ObjectMetadata class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: tdl-auth   File: PageUploader.java   Source Code and License Vote up 5 votes
public String uploadPage(String pageContents) {
    String directory = generateDirectory();
    String path = directory + "/index.html";

    InputStream stream = new ByteArrayInputStream(pageContents.getBytes(StandardCharsets.UTF_8));
    ObjectMetadata metadata = new ObjectMetadata();
    metadata.setContentType("text/html");
    metadata.setContentDisposition("inline; filename=\"index.html\"");
    PutObjectRequest request = new PutObjectRequest(bucket, path, stream, metadata)
            .withMetadata(metadata);
    s3client.putObject(request);
    return s3client.getUrl(bucket, path).toString();
}