Is that possible to access HTML (static/dynamc) page on alfresco from application ?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2014 03:17 AM
Hi Guys,
Below is my scenario,
@RequestMapping(value = "/sample", method = RequestMethod.GET)
public String sampleMethod(Model model) {
// Code here
return "test/sample";
}
here is that possible to point my HTML page on Alfresco, like below
@RequestMapping(value = "/sample", method = RequestMethod.GET)
public String sampleMethod(Model model) {
// Code here
return "http://localhost:8080/alfresco/d/d/workspace/SpacesStore/123f412-b1b2-4378-8b9k-16b3ed40caf8/sample";
(or)
return "http://localhost:8080/alfresco/public/alfresco/versions/1/sites/'+ parentFolder.getPath() + "/" + fileName;
}
Thanks
Below is my scenario,
@RequestMapping(value = "/sample", method = RequestMethod.GET)
public String sampleMethod(Model model) {
// Code here
return "test/sample";
}
here is that possible to point my HTML page on Alfresco, like below
@RequestMapping(value = "/sample", method = RequestMethod.GET)
public String sampleMethod(Model model) {
// Code here
return "http://localhost:8080/alfresco/d/d/workspace/SpacesStore/123f412-b1b2-4378-8b9k-16b3ed40caf8/sample";
(or)
return "http://localhost:8080/alfresco/public/alfresco/versions/1/sites/'+ parentFolder.getPath() + "/" + fileName;
}
Thanks
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2014 06:21 AM
It looks to me like you want to read the content of the node and return that, unless I'm misreading your requirement.
Try here:
http://wiki.alfresco.com/wiki/NodeRef_cookbook#Reading_the_data_content_of_a_NodeRef_.28plain_text.2...
Try here:
http://wiki.alfresco.com/wiki/NodeRef_cookbook#Reading_the_data_content_of_a_NodeRef_.28plain_text.2...

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2014 07:48 AM
Thanks for your reply. In detail, I have my HTML file (sample.html) and uploaded into alfresco (into sites or user homes). Now I need to point that HTML file to render UI of my application.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2014 02:57 AM
The download url for content is:
1.http://localhost:8080/alfresco/service/api/node/content{property}/{store_type}/{store_id}/{id}
for example
or
2.
http://localhost:8080/alfresco/d/d/{store_type}/{store_id}/{id}/nodename
for example
But both url need to be authenticated first.
1.http://localhost:8080/alfresco/service/api/node/content{property}/{store_type}/{store_id}/{id}
for example
http://localhost:8080/alfresco/service/api/node/content/workspace/SpacesStore/41543010-5de5-4b03-8d2...
or
2.
http://localhost:8080/alfresco/d/d/{store_type}/{store_id}/{id}/nodename
for example
http://localhost:8080/alfresco/d/d/workspace/SpacesStore/41543010-5de5-4b03-8d2b-856fe59f957d/201308...
But both url need to be authenticated first.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2014 03:25 AM
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>
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>
