|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
MetadataI created an object that has public access and put user metadata information along with the object.
The question is, can that metadata be accesible by anyone? Or only by the owner? If you can, how do I do i access the metadata info from a public object with jet3st? Cheers, rgn |
|
|
Re: MetadataHi,
When an S3 object is public all of the object's data is publicly accessible, including the metadata which is simply returned as HTTP headers with the rest of the object. To access an object's metadata with JetS3t, use the S3Service#getObject or S3Service#getObjectDetails to retrieve an S3Object from S3, then access the metadata using the S3Object#getMetadataMap or S3Object#getModifiableMetadata methods. James --- http://www.jamesmurty.com On Wed, Dec 10, 2008 at 4:04 AM, notowidigdo <rama.notowidigdo@...> wrote:
|
|
|
Re: MetadatagetMetaDataMap() and getModifiableMetadata() do not return any custom meta data fields added to the S3Object using e.g x-amz-description , does not appear over here.
To get hold of description metadata we need to retrieve the S3ObjectDetails, Following is the sample groovy code for it, Calendar cal = Calendar.instance; cal.add(Calendar.MINUTE, 5); Date expiryDate = cal.getTime(); org.jets3t.service.utils.signedurl.SignedUrlHandler signedUrlHandler = new RestS3Service(null); org.jets3t.service.S3Service s3 = new RestS3Service(awsCredentials) def s3files = s3.listObjects("trial") s3files.each { def headUrl = s3.createSignedHeadUrl(it.bucketName, it.key, awsCredentials, expiryDate, false); S3Object objDetails = signedUrlHandler.getObjectDetailsWithSignedUrl(headUrl); def description = objDetails.getMetadata("description") } We are retrieving S3Object twice, and somehow I do not know how to get around it, this is kind of a workaround.
|
|
|
Re: MetadataI'm afraid you will need to perform a HEAD or GET request for every object when you need the object's metadata, because the S3 service does not return custom metadata information when you list the objects in a bucket.
On Wed, Jan 14, 2009 at 3:02 AM, MarkAtHarvest <mark@...> wrote:
|
|
|
Re: MetadataThank you, thats fine, it works great this way too...
Thanks again for the help and a wondeful library
|
| Free embeddable forum powered by Nabble | Forum Help |