Hi All,
I am creating a CSV file in AEM for which I am using assetManager createAsset method but that is deprecated now.
What is the correct API to use instead?
InputStream is = new ByteArrayInputStream(testData);
assetManager.createAsset(BASE_OUTPUT_FOLDER_PATH + "/"+ reportConfig.getReportFormBean().getReportName(), is,
"text/csv", true);
Solved! Go to Solution.
Hi All,
I think I am good with question as I am now using createOrReplaceAsset method
createAsset method is not well suited with new architecture and have performance issues
In AEM as a Cloud Service, assets should instead take advantage of direct binary access. A discussion of this change as well as an SDK to ease implementation of this new pattern can be found at aem-upload.
Below is the updated code I am using
byte[] csvData = stream.toByteArray(); InputStream is = new ByteArrayInputStream(csvData); final ValueFactory valueFactory = session.getValueFactory(); final Binary binary = valueFactory.createBinary(is); Asset csv = assetManager.createOrReplaceAsset( BASE_OUTPUT_FOLDER_PATH + "/" + reportConfig.getReportFormBean().getReportName(), binary, "text/csv", true);
Thanks,
Shehjad
Hi,
See below link if it solves your requirement..
Assets HTTP API. | Adobe Experience Manager
you can get more details on below thread..
Hi All,
I think I am good with question as I am now using createOrReplaceAsset method
createAsset method is not well suited with new architecture and have performance issues
In AEM as a Cloud Service, assets should instead take advantage of direct binary access. A discussion of this change as well as an SDK to ease implementation of this new pattern can be found at aem-upload.
Below is the updated code I am using
byte[] csvData = stream.toByteArray(); InputStream is = new ByteArrayInputStream(csvData); final ValueFactory valueFactory = session.getValueFactory(); final Binary binary = valueFactory.createBinary(is); Asset csv = assetManager.createOrReplaceAsset( BASE_OUTPUT_FOLDER_PATH + "/" + reportConfig.getReportFormBean().getReportName(), binary, "text/csv", true);
Thanks,
Shehjad