public String addHiddenContent ( String spaceId , String contentId , String contentMimeType , InputStream content ) { log . debug ( "addHiddenContent(" + spaceId + ", " + contentId + ", " + contentMimeType + ")" ) ; // Will throw if bucket does not exist String bucketName = getBucketName ( spaceId ) ; // Wrap the content in order to be able to retrieve a checksum if ( contentMimeType == null || contentMimeType . equals ( "" ) ) { contentMimeType = DEFAULT_MIMETYPE ; } ObjectMetadata objMetadata = new ObjectMetadata ( ) ; objMetadata . setContentType ( contentMimeType ) ; PutObjectRequest putRequest = new PutObjectRequest ( bucketName , contentId , content , objMetadata ) ; putRequest . setStorageClass ( DEFAULT_STORAGE_CLASS ) ; putRequest . setCannedAcl ( CannedAccessControlList . Private ) ; try { PutObjectResult putResult = s3Client . putObject ( putRequest ) ; return putResult . getETag ( ) ; } catch ( AmazonClientException e ) { String err = "Could not add content " + contentId + " with type " + contentMimeType + " to S3 bucket " + bucketName + " due to error: " + e . getMessage ( ) ; throw new StorageException ( err , e , NO_RETRY ) ; } }
Adds content to a hidden space .