List of usage examples for com.amazonaws.services.s3.model ListObjectsRequest setRequestCredentials
@Deprecated public void setRequestCredentials(AWSCredentials credentials)
From source file:org.entando.entando.plugins.jps3awsclient.aps.system.services.storage.AmazonS3StorageManager.java
License:Open Source License
public ObjectListing getS3Objects(String prefix) throws ApsSystemException { if (!this.isActive()) { return null; }/*from w w w. j a va 2s. c o m*/ if (prefix == null || prefix.trim().length() == 0) { return null; } try { String key = prefix; if (!key.endsWith("/")) { key += "/"; } ListObjectsRequest lor = new ListObjectsRequest(); lor.setBucketName(this.getBucketName()); lor.setPrefix(key); lor.setDelimiter("/"); AWSCredentials creds = new BasicAWSCredentials(this.getCredentialKey(), this.getCredentialSecret()); lor.setRequestCredentials(creds); lor.setPrefix(key); return this.getS3Client().listObjects(lor); } catch (Throwable t) { _logger.error("error in getS3Objects", t); throw new ApsSystemException("Error", t); } }