I have a structure on amazon like this -
(bucket name) MyImages
--- (key) general
---- 1.jpg
---- 2.jpg
I have created the key (general) by using S3 Firefox Organizer tool and set read permission for all. Now, by a java program when I am uploading the images inside this key, I want to set the permission of each object as the key have. But its not happening and I have to write some extra line of code for setting up the permissions of each object.
AccessControlList acl = s3.getBucketAcl("MyImages");
// give everyone read access
acl.grantPermission(GroupGrantee.AllUsers, Permission.Read);
s3.setObjectAcl("MyImages", "general/1.jpg", acl);
Is there any way to get rid of above code. Why the objects are not getting the permission as the key or bucket?