diff --git a/build.number b/build.number index b55c744..9c806a6 100644 --- a/build.number +++ b/build.number @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Mon Nov 13 16:47:10 CET 2023 -build.number=9 +#Wed Nov 15 10:40:45 CET 2023 +build.number=10 diff --git a/source/java/src/org/lucee/extension/resource/s3/AmazonS3Client.java b/source/java/src/org/lucee/extension/resource/s3/AmazonS3Client.java index cd90934..6e985dc 100644 --- a/source/java/src/org/lucee/extension/resource/s3/AmazonS3Client.java +++ b/source/java/src/org/lucee/extension/resource/s3/AmazonS3Client.java @@ -61,6 +61,7 @@ public static AmazonS3Client get(String accessKeyId, String secretAccessKey, Str client = pool.get(key); if (client == null || client.isExpired()) { pool.put(key, client = new AmazonS3Client(accessKeyId, secretAccessKey, host, region, key, liveTimeout, pathStyleAccess, log)); + if (log != null) log.debug("S3", "create client for [" + accessKeyId + ":...@" + host + "]"); } } diff --git a/source/java/src/org/lucee/extension/resource/s3/S3.java b/source/java/src/org/lucee/extension/resource/s3/S3.java index 908537f..2e1cf25 100755 --- a/source/java/src/org/lucee/extension/resource/s3/S3.java +++ b/source/java/src/org/lucee/extension/resource/s3/S3.java @@ -66,6 +66,7 @@ import lucee.loader.engine.CFMLEngine; import lucee.loader.engine.CFMLEngineFactory; import lucee.loader.util.Util; +import lucee.runtime.config.Config; import lucee.runtime.exp.PageException; import lucee.runtime.net.s3.Properties; import lucee.runtime.type.Array; @@ -106,6 +107,8 @@ public class S3 { private static Map instances = new ConcurrentHashMap(); private static Map caches = new ConcurrentHashMap(); + private static String logName; + private static Log _log; private final String host; private final String accessKeyId; private final String secretAccessKey; @@ -116,9 +119,9 @@ public class S3 { private final S3Cache cache; - private Log log; + private final Log log; - public static S3 getInstance(S3Properties props, long cache) { + public static S3 getInstance(S3Properties props, long cache, Config config) { String keyS3 = props.getAccessKeyId() + ":" + props.getSecretAccessKey() + ":" + props.getHost() + ":" + props.getDefaultLocation() + ":" + cache; S3 s3 = instances.get(keyS3); @@ -133,25 +136,50 @@ public static S3 getInstance(S3Properties props, long cache) { synchronized (caches) { c = caches.get(keyCache); if (c == null) { - caches.put(keyCache, c = new S3Cache(getLog())); + caches.put(keyCache, c = new S3Cache(getLog(config))); } } } instances.put(keyS3, s3 = new S3(c, props.getAccessKeyId(), props.getSecretAccessKey(), props.getHost(), props.getDefaultLocation(), cache, - S3.DEFAULT_LIVE_TIMEOUT, true, getLog())); + S3.DEFAULT_LIVE_TIMEOUT, true, config)); } } } return s3; } - private static Log getLog() { - try { - return CFMLEngineFactory.getInstance().getThreadConfig().getLog("application"); - } - catch (Exception e) { + public static Log getLog(Config config) { + if (config == null) config = CFMLEngineFactory.getInstance().getThreadConfig(); + + if (_log == null || _log.getClass().getClassLoader() != config.getClass().getClassLoader()) { + // does the logName exist? + if (logName == null) { + synchronized (DEFAULT_HOST) { + if (logName == null) { + if (config != null) { + try { + for (String ln: S3Util.getLogNames(config)) { + if ("s3".equalsIgnoreCase(ln)) { + logName = ln; + break; + } + } + } + catch (Exception e) { + } + } + if (logName == null) { + logName = "application"; + } + } + } + } + + if (config != null) { + _log = config.getLog(logName); + } } - return null; + return _log; } /** @@ -164,7 +192,8 @@ private static Log getLog() { * @param log * @throws S3Exception */ - private S3(S3Cache cache, String accessKeyId, String secretAccessKey, String host, String defaultLocation, long cacheTimeout, long liveTimeout, boolean cacheRegions, Log log) { + private S3(S3Cache cache, String accessKeyId, String secretAccessKey, String host, String defaultLocation, long cacheTimeout, long liveTimeout, boolean cacheRegions, + Config config) { this.cache = cache; this.accessKeyId = accessKeyId; this.secretAccessKey = secretAccessKey; @@ -183,7 +212,7 @@ private S3(S3Cache cache, String accessKeyId, String secretAccessKey, String hos if (cacheRegions) { new CacheRegions().start(); } - this.log = log; + this.log = getLog(config); } public String getHost() { @@ -225,6 +254,7 @@ public Bucket createDirectory(String bucketName, Object acl, String targetRegion AmazonS3Client client = getAmazonS3(null, region); try { b = client.createBucket(cbr); + if (log != null) log.debug("S3", "created bucket [" + bucketName + "]"); } catch (AmazonServiceException ase) { // TODO better way to handle this situation @@ -234,6 +264,7 @@ public Bucket createDirectory(String bucketName, Object acl, String targetRegion if (expectedRegion != null && !expectedRegion.equalsIgnoreCase(defaultRegion)) { client = getAmazonS3(null, expectedRegion); b = client.createBucket(cbr); + if (log != null) log.debug("S3", "created bucket [" + bucketName + "]"); return b; } } @@ -314,12 +345,14 @@ public void createDirectory(String bucketName, String objectName, Object acl, fi try { client.putObject(por); flushExists(bucketName, objectName); + if (log != null) log.debug("S3", "put object (directory) [" + bucketName + "/" + objectName + "]"); } catch (AmazonServiceException ase) { if (ase.getErrorCode().equals("NoSuchBucket")) { createDirectory(bucketName, acl, region); client.putObject(por); flushExists(bucketName, objectName); + if (log != null) log.debug("S3", "put object (directory) [" + bucketName + "/" + objectName + "]"); } else throw toS3Exception(ase); } @@ -363,12 +396,14 @@ public void createFile(String bucketName, String objectName, Object acl, String try { client.putObject(por); flushExists(bucketName, objectName); + if (log != null) log.debug("S3", "put object (file) [" + bucketName + "/" + objectName + "]"); } catch (AmazonServiceException ase) { if (ase.getErrorCode().equals("NoSuchBucket")) { createDirectory(bucketName, acl, region); client.putObject(por); flushExists(bucketName, objectName); + if (log != null) log.debug("S3", "put object (file) [" + bucketName + "/" + objectName + "]"); } else throw toS3Exception(ase); } @@ -388,6 +423,8 @@ public S3Object getData(String bucketName, String objectName) throws S3Exception AmazonS3Client client = getAmazonS3(bucketName, null); try { + if (log != null) log.debug("S3", "get data from [" + bucketName + "/" + objectName + "]"); + if (log != null) log.debug("S3", "get [" + bucketName + "/" + objectName + "]"); return client.getObject(bucketName, objectName); } catch (AmazonServiceException se) { @@ -414,6 +451,7 @@ public S3ObjectSummary getInfo(String bucketName, String objectName) throws S3Ex bucketName = improveBucketName(bucketName); objectName = improveObjectName(objectName); + if (log != null) log.debug("S3", "get info [" + bucketName + "/" + objectName + "]"); S3Info info = get(bucketName, objectName); if (info instanceof StorageObjectWrapper) { return fixBackBlazeBug(((StorageObjectWrapper) info).getStorageObject(), bucketName); @@ -449,7 +487,7 @@ public URL generatePresignedURL(String bucketName, String objectName, Date expir String contentType, String contentDisposition, String contentEncoding, String versionId, Boolean zeroByteContent, Struct customResponseHeaders) throws S3Exception { bucketName = improveBucketName(bucketName); objectName = improveObjectName(objectName); - + if (log != null) log.debug("S3", "generate presigned URL for [" + bucketName + "/" + objectName + "]"); // http method HttpMethod method; if (Util.isEmpty(httpMethod, true)) method = HttpMethod.GET; @@ -619,6 +657,7 @@ public List list(boolean recursive, boolean listPseudoFolder) throws S3E client = getAmazonS3(null, null); List s3buckets = client.listBuckets(); + if (log != null) log.debug("S3", "list buckets (recursive:" + recursive + ";listPseudoFolder:" + listPseudoFolder + ")"); long now = System.currentTimeMillis(); cache.buckets = new ValidUntilMap(now + cacheTimeout); for (Bucket s3b: s3buckets) { @@ -704,14 +743,18 @@ public List listObjects(String bucketName) throws S3Exception { AmazonS3Client client = getAmazonS3(bucketName, null); try { ObjectListing objects = client.listObjects(bucketName); + /* Recursively delete all the objects inside given bucket */ List list = new ArrayList<>(); + int sum = 0; if (objects != null) { List summeries = objects.getObjectSummaries(); if (summeries != null) { + sum += summeries.size(); while (true) { for (S3ObjectSummary summary: summeries) { fixBackBlazeBug(summary, bucketName); + if (log != null) log.debug("S3", "get [" + bucketName + "/" + summary.getKey() + "]"); list.add(client.getObject(bucketName, summary.getKey())); } if (objects.isTruncated()) { @@ -723,6 +766,7 @@ public List listObjects(String bucketName) throws S3Exception { } } } + if (log != null) log.debug("S3", "list objects (" + sum + ") for [" + bucketName + "/" + "]"); return list; } catch (AmazonServiceException ase) { @@ -784,12 +828,14 @@ public Query listObjectsAsQuery(String bucketName) throws S3Exception, PageExcep ObjectListing objects = client.listObjects(bucketName); /* Recursively delete all the objects inside given bucket */ - List list = new ArrayList<>(); if (objects != null && objects.getObjectSummaries() != null) { - int row; + int row, sum = 0; + List summeries; while (true) { - for (S3ObjectSummary summary: objects.getObjectSummaries()) { + summeries = objects.getObjectSummaries(); + sum += summeries.size(); + for (S3ObjectSummary summary: summeries) { fixBackBlazeBug(summary, bucketName); row = qry.addRow(); qry.setAt(objectName, row, summary.getKey()); @@ -804,8 +850,8 @@ public Query listObjectsAsQuery(String bucketName) throws S3Exception, PageExcep break; } } + if (log != null) log.debug("S3", "list objects as query (" + sum + ") for [" + bucketName + "/" + "]"); } - return qry; } catch (AmazonServiceException ase) { @@ -888,6 +934,7 @@ private ValidUntilMap _list(String bucketName, String objectName, boolea outer: while (true) { AmazonS3Client client = getAmazonS3(null, null); try { + if (log != null) log.debug("S3", "list buckets "); for (Bucket b: client.listBuckets()) { // TOD is there a more direct way? if (b.getName().equals(bucketName)) { @@ -906,8 +953,10 @@ private ValidUntilMap _list(String bucketName, String objectName, boolea ObjectListing list = (hasObjName ? client.listObjects(bucketName, nameFile) : client.listObjects(bucketName)); try { if (list != null && list.getObjectSummaries() != null) { + int sum = 0; while (true) { List kids = list.getObjectSummaries(); + sum += kids.size(); StorageObjectWrapper tmp; String name; for (S3ObjectSummary kid: kids) { @@ -934,6 +983,7 @@ private ValidUntilMap _list(String bucketName, String objectName, boolea break; } } + if (log != null) log.debug("S3", "list objects (" + sum + ") for [" + bucketName + "/" + nameFile + "]"); } } finally { @@ -1009,6 +1059,7 @@ private boolean existsNotTouchBucketItself(String bucketName) throws S3Exception try { // delete the content of the bucket // in case bucket does not exist, it will throw an error client.listObjects(bucketName, "sadasdsadasdasasdasd"); + if (log != null) log.debug("S3", "list objects for [" + bucketName + "/sadasdsadasdasasdasd]"); cache.existBuckets.put(bucketName, new S3BucketExists(bucketName, now + cacheTimeout, true)); return true; } @@ -1025,14 +1076,17 @@ private boolean existsNotTouchBucketItself(String bucketName) throws S3Exception } public boolean isDirectory(String bucketName, String objectName) throws S3Exception { + if (log != null) log.debug("S3", "is directory? [" + bucketName + "/" + objectName + "]"); return is(bucketName, objectName, CHECK_IS_DIR); } public boolean isFile(String bucketName, String objectName) throws S3Exception { + if (log != null) log.debug("S3", "is file? [" + bucketName + "/" + objectName + "]"); return is(bucketName, objectName, CHECK_IS_FILE); } public boolean exists(String bucketName, String objectName) throws S3Exception { + if (log != null) log.debug("S3", "exists? [" + bucketName + "/" + objectName + "]"); return is(bucketName, objectName, CHECK_EXISTS); } @@ -1050,6 +1104,7 @@ public String getContentType(String bucketName, String objectName) throws Amazon objectName = improveObjectName(objectName); AmazonS3Client client = getAmazonS3(bucketName, null); try { + if (log != null) log.debug("S3", "get meta data [" + bucketName + "/" + objectName + "]"); return client.getObjectMetadata(bucketName, objectName).getContentType(); } finally { @@ -1086,6 +1141,7 @@ public S3Info get(String bucketName, final String objectName) throws S3Exception lor.setPrefix(nameFile); lor.setMaxKeys(100); + if (log != null) log.debug("S3", "list objects (max:100) for [" + bucketName + "/" + nameFile + "]"); objects = client.listObjects(lor); } catch (Exception e) { @@ -1195,10 +1251,12 @@ public void delete(String bucketName, boolean force) throws S3Exception { if (force) { clear(bucketName, 0); client.deleteBucket(bucketName); + if (log != null) log.debug("S3", "deleted bucket [" + bucketName + "]"); } else { client.deleteBucket(bucketName); flushExists(bucketName, true); + if (log != null) log.debug("S3", "deleted bucket [" + bucketName + "]"); } } @@ -1228,8 +1286,12 @@ public void delete(String bucketName, String objectName, boolean force) throws S ObjectListing objects = client.listObjects(bucketName, nameFile); List matches = new ArrayList<>(); if (objects != null && objects.getObjectSummaries() != null) { + int sum = 0; + List summeries; while (true) { - for (S3ObjectSummary summary: objects.getObjectSummaries()) { + summeries = objects.getObjectSummaries(); + sum += summeries.size(); + for (S3ObjectSummary summary: summeries) { fixBackBlazeBug(summary, bucketName); if (summary.getKey().equals(nameFile)) { matchFile = true; @@ -1248,6 +1310,7 @@ else if (summary.getKey().startsWith(nameDir)) { break; } } + if (log != null) log.debug("S3", "list objects (" + sum + ") for [" + bucketName + "/" + nameFile + "]"); } else { throw new S3Exception("can't delete file/directory " + bucketName + "/" + objectName + ", file/directory does not exist"); @@ -1268,6 +1331,7 @@ else if (summary.getKey().startsWith(nameDir)) { DeleteObjectsRequest dor = new DeleteObjectsRequest(bucketName).withKeys(matches).withQuiet(false); client.deleteObjects(dor); flushExists(bucketName, objectName); + if (log != null) log.debug("S3", "deleted object in bucket [" + bucketName + "]"); // we create parent because before it maybe was a pseudi dir createParentDirectory(bucketName, objectName, true); } @@ -1294,11 +1358,13 @@ public void clear(String bucketName, long maxAge) throws S3Exception { bucketName = improveBucketName(bucketName); AmazonS3Client client = getAmazonS3(bucketName, null); try { - ObjectListing objects = client.listObjects(bucketName); if (objects != null && objects.getObjectSummaries() != null) { + int sum = 0; while (true) { - List filtered = toObjectKeyAndVersions(objects.getObjectSummaries(), maxAge); + List summeries = objects.getObjectSummaries(); + sum += summeries.size(); + List filtered = toObjectKeyAndVersions(summeries, maxAge); if (filtered != null && filtered.size() > 0) { DeleteObjectsRequest dor = new DeleteObjectsRequest(bucketName).withKeys(filtered).withQuiet(false); client.deleteObjects(dor); @@ -1311,15 +1377,18 @@ public void clear(String bucketName, long maxAge) throws S3Exception { break; } } + if (log != null) log.debug("S3", "Recursively delete all objects (" + sum + ") inside bucket [" + bucketName + "]"); } /* Get list of versions in a given bucket */ VersionListing versions = client.listVersions(new ListVersionsRequest().withBucketName(bucketName)); - /* Recursively delete all the versions inside given bucket */ if (versions != null && versions.getVersionSummaries() != null) { + int sum = 0; while (true) { - for (S3VersionSummary summary: versions.getVersionSummaries()) { + List summeries = versions.getVersionSummaries(); + sum += summeries.size(); + for (S3VersionSummary summary: summeries) { client.deleteObject(bucketName, summary.getKey()); } @@ -1330,6 +1399,8 @@ public void clear(String bucketName, long maxAge) throws S3Exception { break; } } + if (log != null) log.debug("S3", "Recursively delete all the versions (" + sum + ") inside bucket [" + bucketName + "]"); + } flushExists(bucketName, false); @@ -1387,6 +1458,7 @@ public void copyObject(String srcBucketName, String srcObjectName, String trgBuc if (acl != null) setACL(cor, acl); try { trgClient.copyObject(cor); + if (log != null) log.debug("S3", "copy object from [" + srcBucketName + "/" + srcObjectName + " to " + trgBucketName + "/" + trgObjectName + "]"); } catch (AmazonServiceException se) { // could be an Pseudo folder @@ -1424,6 +1496,7 @@ else if (se.getErrorCode().equals("NoSuchBucket") && !srcClient.doesBucketExistV try { try { clientTarget.createBucket(cbr); + if (log != null) log.debug("S3", "create bucket [" + trgBucketName + "]"); } catch (AmazonS3Exception e) { if (customACL) throw e; @@ -1432,6 +1505,8 @@ else if (se.getErrorCode().equals("NoSuchBucket") && !srcClient.doesBucketExistV } trgClient.copyObject(cor); + if (log != null) + log.debug("S3", "copy object from [" + srcBucketName + "/" + srcObjectName + " to " + trgBucketName + "/" + trgObjectName + "] (fallback)"); } finally { clientTarget.release(); @@ -1542,7 +1617,7 @@ public void write(String bucketName, String objectName, String data, String mime bucketName = improveBucketName(bucketName); objectName = improveObjectName(objectName, false); flushExists(bucketName, objectName); - + if (log != null) log.debug("S3", "write string (" + (data == null ? 0 : data.length()) + ") to [" + bucketName + "/" + objectName + "]"); AmazonS3Client client = getAmazonS3(bucketName, region); String ct = toContentType(mimeType, charset, null); byte[] bytes = charset == null ? data.getBytes() : data.getBytes(charset); @@ -1616,6 +1691,7 @@ public void write(String bucketName, String objectName, String data, String mime public void write(String bucketName, String objectName, byte[] data, String mimeType, Object acl, String region) throws IOException { bucketName = improveBucketName(bucketName); objectName = improveObjectName(objectName, false); + if (log != null) log.debug("S3", "write byte array (" + (data == null ? 0 : data.length) + ") to [" + bucketName + "/" + objectName + "]"); flushExists(bucketName, objectName); AmazonS3Client client = getAmazonS3(bucketName, region); @@ -1667,7 +1743,7 @@ public void write(String bucketName, String objectName, byte[] data, String mime public void write(String bucketName, String objectName, File file, Object acl, String region) throws IOException { bucketName = improveBucketName(bucketName); objectName = improveObjectName(objectName, false); - + if (log != null) log.debug("S3", "write file [" + file + "] to [" + bucketName + "/" + objectName + "]"); String ct = CFMLEngineFactory.getInstance().getResourceUtil().getMimeType(max1000(file), null); ObjectMetadata md = new ObjectMetadata(); md.setContentLength(file.length()); @@ -1775,6 +1851,7 @@ public void write(String bucketName, String objectName, Resource res, Object acl write(bucketName, objectName, (File) res, acl, region); return; } + if (log != null) log.debug("S3", "write resource [" + res + "] to [" + bucketName + "/" + objectName + "]"); String ct = CFMLEngineFactory.getInstance().getResourceUtil().getMimeType(max1000(res), null); // write(bucketName, objectName, res.getInputStream(), res.length(), true, ct, acl, region); @@ -1857,6 +1934,7 @@ public Struct getMetaDataStruct(String bucketName, String objectName) throws S3E S3Object o = client.getObject(bucketName, objectName); ObjectMetadata md = o.getObjectMetadata(); + if (log != null) log.debug("S3", "get [" + bucketName + "/" + objectName + "]"); Map rmd = md.getRawMetadata(); Iterator> it = rmd.entrySet().iterator(); @@ -1894,6 +1972,7 @@ public ObjectMetadata getObjectMetadata(String bucketName, String objectName) th objectName = improveObjectName(objectName); AmazonS3Client client = getAmazonS3(bucketName, null); try { + if (log != null) log.debug("S3", "get [" + bucketName + "/" + objectName + "] for meta data"); return client.getObject(bucketName, objectName).getObjectMetadata(); } finally { @@ -2041,12 +2120,13 @@ public void addAccessControlList(String bucketName, String objectName, Object ob try { client.setObjectAcl(bucketName, objectName, acl); - // is it necessary to set it for bucket as well? + if (log != null) log.debug("S3", "added ACL to [" + bucketName + "/" + objectName + "]"); } catch (AmazonServiceException se) { if (se.getErrorCode().equals("NoSuchKey")) { // we know at this point objectname is not empty, so we do not have to check that try { client.setObjectAcl(bucketName, oppositeObjectName(objectName), acl); + if (log != null) log.debug("S3", "added ACL to [" + bucketName + "/" + objectName + "]"); return; } catch (AmazonServiceException ise) { @@ -2084,10 +2164,12 @@ public void setAccessControlList(AmazonS3Client client, String bucketName, Strin if (!Util.isEmpty(objectName)) { if (newACL instanceof AccessControlList) client.setObjectAcl(bucketName, objectName, (AccessControlList) newACL); else client.setObjectAcl(bucketName, objectName, (CannedAccessControlList) newACL); + if (log != null) log.debug("S3", "added ACL to [" + bucketName + "/" + objectName + "]"); } else { if (newACL instanceof AccessControlList) client.setBucketAcl(bucketName, (AccessControlList) newACL); else client.setBucketAcl(bucketName, (CannedAccessControlList) newACL); + if (log != null) log.debug("S3", "added ACL to [" + bucketName + "]"); } } @@ -2096,6 +2178,7 @@ public void setAccessControlList(AmazonS3Client client, String bucketName, Strin try { if (newACL instanceof AccessControlList) client.setObjectAcl(bucketName, oppositeObjectName(objectName), (AccessControlList) newACL); else client.setObjectAcl(bucketName, oppositeObjectName(objectName), (CannedAccessControlList) newACL); + if (log != null) log.debug("S3", "added ACL to [" + bucketName + "/" + objectName + "]"); return; } catch (AmazonServiceException ise) { @@ -2117,6 +2200,7 @@ public void setAccessControlList(AmazonS3Client client, String bucketName, Strin public Array getAccessControlList(String bucketName, String objectName) throws S3Exception { AccessControlList acl = getACL(null, bucketName, objectName, false); + if (log != null) log.debug("S3", "get ACL for [" + bucketName + "/" + objectName + "]"); return AccessControlListUtil.toArray(acl.getGrantsAsList()); } @@ -2188,6 +2272,7 @@ private AmazonS3Client getAmazonS3(String bucketName, String strRegion, boolean } public Region getBucketRegion(String bucketName, boolean loadIfNecessary) throws S3Exception { + if (log != null) log.debug("S3", "get region for bucket [" + bucketName + "]"); bucketName = improveBucketName(bucketName); Region r = cache.bucketRegions.get(bucketName); @@ -2653,13 +2738,13 @@ public void run() { } catch (S3Exception e1) { if (!"AccessDenied".equalsIgnoreCase(e1.getErrorCode())) { // in case we can not the region because of access right, we don't care. - if (log != null) log.error("s3", e1); + if (log != null) log.log(Log.LEVEL_DEBUG, "s3", e1); else e1.printStackTrace(); } } catch (Exception e) { if (!(e.getCause() instanceof UnknownHostException)) { - if (log != null) log.error("s3", e); + if (log != null) log.log(Log.LEVEL_DEBUG, "s3", e); } } @@ -2668,7 +2753,7 @@ public void run() { if (client != null) client.release(); } catch (S3Exception e) { - if (log != null) log.error("s3", e); + if (log != null) log.log(Log.LEVEL_DEBUG, "s3", e); } } } diff --git a/source/java/src/org/lucee/extension/resource/s3/S3Properties.java b/source/java/src/org/lucee/extension/resource/s3/S3Properties.java index e69b260..22cdc87 100644 --- a/source/java/src/org/lucee/extension/resource/s3/S3Properties.java +++ b/source/java/src/org/lucee/extension/resource/s3/S3Properties.java @@ -170,7 +170,7 @@ public static Struct getApplicationData(PageContext pc) { } } catch (Exception e) { - Log log = pc.getConfig().getLog("application"); + Log log = S3.getLog(pc != null ? pc.getConfig() : CFMLEngineFactory.getInstance().getThreadConfig()); if (log != null) log.error("S3", e); } @@ -196,7 +196,7 @@ else if (eng.getClassUtil().isInstaneOf("lucee.runtime.listener.ClassicApplicati } } catch (Exception e) { - Log log = pc.getConfig().getLog("application"); + Log log = S3.getLog(pc != null ? pc.getConfig() : CFMLEngineFactory.getInstance().getThreadConfig()); if (log != null) log.error("S3", e); } } diff --git a/source/java/src/org/lucee/extension/resource/s3/S3Resource.java b/source/java/src/org/lucee/extension/resource/s3/S3Resource.java index cc9c56c..7389fab 100755 --- a/source/java/src/org/lucee/extension/resource/s3/S3Resource.java +++ b/source/java/src/org/lucee/extension/resource/s3/S3Resource.java @@ -141,7 +141,6 @@ public void createFile(boolean createParentWhenNotExists) throws IOException { @Override public InputStream getInputStream() throws IOException { - engine.getResourceUtil().checkGetInputStreamOK(this); provider.read(this); return engine.getIOUtil().toBufferedInputStream(s3.getInputStream(bucketName, objectName)); } diff --git a/source/java/src/org/lucee/extension/resource/s3/S3ResourceProvider.java b/source/java/src/org/lucee/extension/resource/s3/S3ResourceProvider.java index fbf53cf..ee312ef 100755 --- a/source/java/src/org/lucee/extension/resource/s3/S3ResourceProvider.java +++ b/source/java/src/org/lucee/extension/resource/s3/S3ResourceProvider.java @@ -110,7 +110,7 @@ public Resource getResource(String path) { * props.getCustomHost()); */ - return new S3Resource(engine, S3.getInstance(props, cache), props, location.getValue(), this, path); + return new S3Resource(engine, S3.getInstance(props, cache, engine.getThreadConfig()), props, location.getValue(), this, path); } public static String loadWithNewPattern(S3Properties properties, RefString storage, String path, boolean errorWhenNoCred) { diff --git a/source/java/src/org/lucee/extension/resource/s3/S3Util.java b/source/java/src/org/lucee/extension/resource/s3/S3Util.java index 5f84276..33f7c88 100644 --- a/source/java/src/org/lucee/extension/resource/s3/S3Util.java +++ b/source/java/src/org/lucee/extension/resource/s3/S3Util.java @@ -1,10 +1,21 @@ package org.lucee.extension.resource.s3; +import java.lang.reflect.Method; +import java.util.Collection; + import lucee.commons.io.res.Resource; import lucee.loader.engine.CFMLEngineFactory; import lucee.loader.util.Util; +import lucee.runtime.PageContext; +import lucee.runtime.config.Config; +import lucee.runtime.exp.PageException; public class S3Util { + private static final Class[] EMPTY_CLASS = new Class[0]; + private static final Object[] EMPTY_OBJ = new Object[0]; + private static Method pcGetLogNames; + private static Method configGetLogNames; + public static String getSystemPropOrEnvVar(String name, String defaultValue) { // env String value = System.getenv(name); @@ -59,4 +70,27 @@ public static String removeSecret(Resource res, String msg) { } return msg; } + + // java.util.Collection getLogNames() + public static java.util.Collection getLogNames(PageContext pc) throws PageException { + try { + if (pcGetLogNames == null || pcGetLogNames.getDeclaringClass() != pc.getClass()) pcGetLogNames = pc.getClass().getMethod("getLogNames", EMPTY_CLASS); + return (Collection) pcGetLogNames.invoke(pc, EMPTY_OBJ); + } + catch (Exception e) { + throw CFMLEngineFactory.getInstance().getCastUtil().toPageException(e); + } + } + + // public String[] getLogNames() { + public static String[] getLogNames(Config config) throws PageException { + try { + if (configGetLogNames == null || configGetLogNames.getDeclaringClass() != config.getClass()) + configGetLogNames = config.getClass().getMethod("getLogNames", EMPTY_CLASS); + return (String[]) configGetLogNames.invoke(config, EMPTY_OBJ); + } + catch (Exception e) { + throw CFMLEngineFactory.getInstance().getCastUtil().toPageException(e); + } + } } diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3AddACL.java b/source/java/src/org/lucee/extension/resource/s3/function/S3AddACL.java index 8655dea..bc1e9f5 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3AddACL.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3AddACL.java @@ -52,7 +52,7 @@ public Object invoke(final PageContext pc, final Object[] args) throws PageExcep try { // create S3 Instance - S3 s3 = S3.getInstance(pae.props != null ? pae.props : toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(pae.props != null ? pae.props : toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); s3.addAccessControlList(pae.bucketName, pae.objectName, objACL); return null; } diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3ClearBucket.java b/source/java/src/org/lucee/extension/resource/s3/function/S3ClearBucket.java index 2934b0e..8370baa 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3ClearBucket.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3ClearBucket.java @@ -21,7 +21,7 @@ public static Object call(PageContext pc, String bucketName, TimeSpan maxAge, St host = null; } try { - S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); s3.clear(bucketName, maxAge == null ? 0 : maxAge.getMillis()); } catch (Exception e) { diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3Copy.java b/source/java/src/org/lucee/extension/resource/s3/function/S3Copy.java index 36156c1..968eedc 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3Copy.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3Copy.java @@ -3,7 +3,6 @@ import org.lucee.extension.resource.s3.AccessControlListUtil; import org.lucee.extension.resource.s3.S3; import org.lucee.extension.resource.s3.S3Exception; -import org.lucee.extension.resource.s3.S3ResourceProvider; import lucee.loader.engine.CFMLEngine; import lucee.loader.engine.CFMLEngineFactory; @@ -39,7 +38,7 @@ public static Object call(PageContext pc, String srcBucketName, String srcObject try { // create S3 Instance - S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); s3.copyObject(srcBucketName, srcObjectName, trgBucketName, trgObjectName, acl, location); } catch (Exception e) { diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3CreateBucket.java b/source/java/src/org/lucee/extension/resource/s3/function/S3CreateBucket.java index 7d1da51..f8cf2b9 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3CreateBucket.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3CreateBucket.java @@ -34,7 +34,7 @@ public Object invoke(PageContext pc, Object[] args) throws PageException { Object acl = null; try { acl = objACL != null ? AccessControlListUtil.toAccessControlList(objACL) : null; - S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); s3.createDirectory(bucketName, acl, location); } catch (Exception e) { diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3Delete.java b/source/java/src/org/lucee/extension/resource/s3/function/S3Delete.java index 1e9b893..3d9201d 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3Delete.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3Delete.java @@ -23,7 +23,7 @@ public static Object call(PageContext pc, String bucketName, String objectName, host = null; } try { - S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); if (Util.isEmpty(objectName, true)) s3.delete(bucketName, force); else s3.delete(bucketName, objectName, force); return null; diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3Download.java b/source/java/src/org/lucee/extension/resource/s3/function/S3Download.java index 4c88ac3..71c05f1 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3Download.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3Download.java @@ -77,7 +77,7 @@ else if (target instanceof Component) { boolean hasBefore = toFunction(csa.get(BEFORE), null) != null; boolean hasAfter = toFunction(csa.get(AFTER), null) != null; UDF invoke = toFunction(csa.get(INVOKE), null); - if (invoke == null) throw eng.getExceptionUtil().createFunctionException(pc, "DirectoryEvery", 2, "component", + if (invoke == null) throw eng.getExceptionUtil().createFunctionException(pc, "S3Download", 2, "component", "the listener component does not contain a instance function with name [invoke] that is required", null); validateInvoke(pc, invoke, mode, blockSize, false); } @@ -92,7 +92,7 @@ else if ((targetRes = S3Write.toResource(pc, target, false, null)) == null) { // create S3 Instance try { - S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); S3Object obj = s3.getData(bucketName, objectName); Cast caster = eng.getCastUtil(); // stream to UDF diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3Exists.java b/source/java/src/org/lucee/extension/resource/s3/function/S3Exists.java index 1cb6d0d..8941358 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3Exists.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3Exists.java @@ -1,7 +1,6 @@ package org.lucee.extension.resource.s3.function; import org.lucee.extension.resource.s3.S3; -import org.lucee.extension.resource.s3.S3ResourceProvider; import lucee.loader.engine.CFMLEngine; import lucee.loader.engine.CFMLEngineFactory; @@ -23,7 +22,7 @@ public static boolean call(PageContext pc, String bucketName, String objectName, } try { // create S3 Instance - S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); if (Util.isEmpty(objectName)) return s3.exists(bucketName); return s3.exists(bucketName, objectName); diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3GeneratePresignedURL.java b/source/java/src/org/lucee/extension/resource/s3/function/S3GeneratePresignedURL.java index 4a4b78b..6d67e25 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3GeneratePresignedURL.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3GeneratePresignedURL.java @@ -52,7 +52,7 @@ public Object invoke(PageContext pc, Object[] args) throws PageException { PropsAndEndpoint pae = extractFromPath(eng, bucketNameOrPath, objectName, accessKeyId, secretAccessKey, host); // create S3 Instance - S3 s3 = S3.getInstance(pae.props != null ? pae.props : toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(pae.props != null ? pae.props : toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); return s3.generatePresignedURL(pae.bucketName, pae.objectName, expireDate, httpMethod, sseAlgorithm, sseCustomerKey, checksum, contentType, contentDisposition, contentEncoding, versionId, zeroByteContent, customResponseHeaders).toExternalForm(); } diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3GenerateURI.java b/source/java/src/org/lucee/extension/resource/s3/function/S3GenerateURI.java index 85a043d..f685910 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3GenerateURI.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3GenerateURI.java @@ -44,7 +44,7 @@ public Object invoke(PageContext pc, Object[] args) throws PageException { PropsAndEndpoint pae = extractFromPath(eng, bucketNameOrPath, objectName, accessKeyId, secretAccessKey, host); // create S3 Instance - S3 s3 = S3.getInstance(pae.props != null ? pae.props : toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(pae.props != null ? pae.props : toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); if (Util.isEmpty(type, true) || (type = type.trim()).equalsIgnoreCase("virtualhost")) { return s3.generateURI(pae.bucketName, pae.objectName, S3.URI_STYLE_VIRTUAL_HOST, secure); diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3GetACL.java b/source/java/src/org/lucee/extension/resource/s3/function/S3GetACL.java index 2196abf..f857df3 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3GetACL.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3GetACL.java @@ -50,7 +50,7 @@ public Object invoke(PageContext pc, Object[] args) throws PageException { try { // create S3 Instance - S3 s3 = S3.getInstance(pae.props != null ? pae.props : toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(pae.props != null ? pae.props : toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); return s3.getAccessControlList(pae.bucketName, pae.objectName); } catch (Exception e) { diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3GetMetaData.java b/source/java/src/org/lucee/extension/resource/s3/function/S3GetMetaData.java index d0c4786..4cc57a1 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3GetMetaData.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3GetMetaData.java @@ -60,7 +60,7 @@ public Object invoke(PageContext pc, Object[] args) throws PageException { S3Properties props = pae.props != null ? pae.props : toS3Properties(pc, accessKeyId, secretAccessKey, host); try { // create S3 Instance - S3 s3 = S3.getInstance(props, toTimeout(timeout)); + S3 s3 = S3.getInstance(props, toTimeout(timeout), pc.getConfig()); return s3.getMetaData(pae.bucketName, pae.objectName); } catch (Exception e) { diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3ListBucket.java b/source/java/src/org/lucee/extension/resource/s3/function/S3ListBucket.java index 8c8e5f0..6520346 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3ListBucket.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3ListBucket.java @@ -1,7 +1,6 @@ package org.lucee.extension.resource.s3.function; import org.lucee.extension.resource.s3.S3; -import org.lucee.extension.resource.s3.S3ResourceProvider; import lucee.loader.engine.CFMLEngine; import lucee.loader.engine.CFMLEngineFactory; @@ -23,7 +22,7 @@ public static Query call(PageContext pc, String bucketName, String accessKeyId, host = null; } try { - S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); return s3.listObjectsAsQuery(bucketName); } diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3ListBuckets.java b/source/java/src/org/lucee/extension/resource/s3/function/S3ListBuckets.java index 469c3d0..fcfbb6f 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3ListBuckets.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3ListBuckets.java @@ -1,7 +1,6 @@ package org.lucee.extension.resource.s3.function; import org.lucee.extension.resource.s3.S3; -import org.lucee.extension.resource.s3.S3ResourceProvider; import lucee.loader.engine.CFMLEngine; import lucee.loader.engine.CFMLEngineFactory; @@ -23,7 +22,7 @@ public static Query call(PageContext pc, String accessKeyId, String secretAccess host = null; } try { - S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); return s3.listBucketsAsQuery(); } diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3Move.java b/source/java/src/org/lucee/extension/resource/s3/function/S3Move.java index afbb416..6f538a2 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3Move.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3Move.java @@ -2,7 +2,6 @@ import org.lucee.extension.resource.s3.S3; import org.lucee.extension.resource.s3.S3Exception; -import org.lucee.extension.resource.s3.S3ResourceProvider; import com.amazonaws.services.s3.model.CannedAccessControlList; @@ -42,7 +41,7 @@ public static Object call(PageContext pc, String srcBucketName, String srcObject try { // create S3 Instance - S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); s3.moveObject(srcBucketName, srcObjectName, trgBucketName, trgObjectName, acl, location); } catch (Exception e) { diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3Read.java b/source/java/src/org/lucee/extension/resource/s3/function/S3Read.java index 374db39..1583d35 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3Read.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3Read.java @@ -1,7 +1,6 @@ package org.lucee.extension.resource.s3.function; import org.lucee.extension.resource.s3.S3; -import org.lucee.extension.resource.s3.S3ResourceProvider; import com.amazonaws.services.s3.model.S3Object; @@ -25,7 +24,7 @@ public static String call(PageContext pc, String bucketName, String objectName, } try { // create S3 Instance - S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); S3Object obj = s3.getData(bucketName, objectName); // copy data diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3ReadBinary.java b/source/java/src/org/lucee/extension/resource/s3/function/S3ReadBinary.java index d7560fb..d3a1c8c 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3ReadBinary.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3ReadBinary.java @@ -3,7 +3,6 @@ import java.io.ByteArrayOutputStream; import org.lucee.extension.resource.s3.S3; -import org.lucee.extension.resource.s3.S3ResourceProvider; import com.amazonaws.services.s3.model.S3Object; @@ -26,7 +25,7 @@ public static byte[] call(PageContext pc, String bucketName, String objectName, } try { // create S3 Instance - S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); S3Object obj = s3.getData(bucketName, objectName); // copy data diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3SetACL.java b/source/java/src/org/lucee/extension/resource/s3/function/S3SetACL.java index ab0baf7..47bb93f 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3SetACL.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3SetACL.java @@ -52,7 +52,7 @@ public Object invoke(PageContext pc, Object[] args) throws PageException { try { // create S3 Instance - S3 s3 = S3.getInstance(pae.props != null ? pae.props : toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(pae.props != null ? pae.props : toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); s3.setAccessControlList(null, pae.bucketName, pae.objectName, objACL); return null; } diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3SetMetaData.java b/source/java/src/org/lucee/extension/resource/s3/function/S3SetMetaData.java index 928762f..6a461a3 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3SetMetaData.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3SetMetaData.java @@ -53,7 +53,7 @@ public Object invoke(PageContext pc, Object[] args) throws PageException { try { // create S3 Instance - S3 s3 = S3.getInstance(pae.props != null ? pae.props : toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(pae.props != null ? pae.props : toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); s3.setMetaData(pae.bucketName, pae.objectName, metadata); return null; } diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3Upload.java b/source/java/src/org/lucee/extension/resource/s3/function/S3Upload.java index fc579a1..53912a6 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3Upload.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3Upload.java @@ -39,7 +39,7 @@ public Object invoke(PageContext pc, Object[] args) throws PageException { Object acl = null; try { acl = objACL != null ? AccessControlListUtil.toAccessControlList(objACL) : null; - S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); s3.write(bucketName, objectName, source, acl, location); } catch (Exception e) { diff --git a/source/java/src/org/lucee/extension/resource/s3/function/S3Write.java b/source/java/src/org/lucee/extension/resource/s3/function/S3Write.java index b928388..8bde0d5 100644 --- a/source/java/src/org/lucee/extension/resource/s3/function/S3Write.java +++ b/source/java/src/org/lucee/extension/resource/s3/function/S3Write.java @@ -41,7 +41,7 @@ public static Object call(PageContext pc, String bucketName, String objectName, try { // create S3 Instance - S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout)); + S3 s3 = S3.getInstance(toS3Properties(pc, accessKeyId, secretAccessKey, host), toTimeout(timeout), pc.getConfig()); value = toResource(pc, value);