Hi,
We also had similar requirement, where the business team will upload the static html files and images into specific report folder.
From Share, we will call abstract webscript by sending the site name and file name.
Where the webscript will read the corresponding file from the report folder and returns the raw file content.
<java>
/* This webscript on the following directory structure:
* - Document Library folder
* - Reports folder
* - HTML_PAGES folder
* - IMAGES folder
*/
/* Identify the site */
SiteInfo siteInfo = siteService.getSite(siteName);
// Fetch the document library node
NodeRef documentLibNodeRef = nodeService.getChildByName(siteInfo.getNodeRef(), ContentModel.ASSOC_CONTAINS, SiteService.DOCUMENT_LIBRARY);
// Fetch the report folder node
NodeRef reportRoot = nodeService.getChildByName(documentLibNodeRef,ContentModel.ASSOC_CONTAINS, REPORTS_ROOT);
String fileType = null;
if (fileName.contains(".htm"))
{
// Report HTML file
fileType = HTML_PAGES;
}
else
{
// Assume everything else is an Image
fileType = IMAGES;
}
// Get the containing folder
NodeRef fileRoot = nodeService.getChildByName(reportRoot, ContentModel.ASSOC_CONTAINS, fileType);
// Get the file, if possible
NodeRef fileNodeRef = nodeService.getChildByName(fileRoot, ContentModel.ASSOC_CONTAINS, fileName);
ContentReader contentReader = fileFolderService.getReader(fileNodeRef);
res.setContentType (contentReader.getContentData().getMimetype());
contentReader.getContent(res.getOutputStream());
</java>