Explanation
This is an example of downloading a file to Amazon S3. If the file stored in S3 does not have 'Public-Read' permissions, the credentialing process may be required, so the 'Region/Bucket/AccessKey/SecretAccessKey' information is required. However, information such as 'AccessKey/SecretAccessKey' is not supposed to be exposed to the outside world, so it is dangerous to use it in public. To download without exposing your AWS credentials, you can generate a pre-signed address on the backend and use that address to download the file.
dx.setDownloadMode("AWSS3");
dx.setAWSS3DownloadConfig({
//type: "SECRET",
signedURL: dx5.canonicalize("../service/awss3-download-helper.do"),
});
The three backend addresses are responsible for generating and returning the signed addresses required for each step of the file upload. To return signed addresses from the backend, you must use the SDK provided by AWS. In the sample project, we put the required AWS SDK JAR files in the WEB-INF/lib directory.
For details on generating signed addresses using the AWS SDK, see the AWSS3Controller and AWSS3DownloadHelper class.
Example
Singe-file download |
|
In the single-file download, when downloading with a signed address, the target is not from the same source, so the browser may not download the target and open it directly. |
|
Multiple-files download |
|
|