Reputation: 83
I have a ftl template file stored in alfresco repository. The path of this file is: /app:company_home/app:dictionary/cm:StarXpert_x0020_Workflow/cm:templates/cm:contentModelTemplate.ftl
I want to use this FTL
file to create an XML
file. In my java backed webscript controller, i want to get the FTL
file, i used many method to achieve this, but nothing works.
I tried this code:
Template template=cfg.getTemplate("PATH:\"/app:company_home/app:dictionary/cm:StarXpert_x0020_Workflow/cm:templates/cm:contentModelTemplate.ftl\"");
But i still getting this error:
java.io.FileNotFoundException: Template "contentModelTemplate.ftl" not found
I also tried to get the template by passing its nodeRef
as reference to the getTemplate()
method, but also it's not works.
Is there anybody who did this before ? Thanks for any hlep.
Upvotes: 3
Views: 576
Reputation: 10538
If the goal is to have your web script respond with the transformed XML file, then why not leverage the web script itself to do this transformation?
To do this, move the Freemarker template from its current home in the Data Dictionary to be part of your web script (I don't know if you are using repository deployed web scripts or classpath deployed web scripts--it doesn't make a functional difference).
Then, your Java-backed web script will grab data and put it in to the model.
The Freemarker template will automatically be used to render an XML response using the data in the model.
Upvotes: 4
Reputation: 3175
You need to use serachService to retrieve the file which resides inside alfresco repository. Below link will help you in using the searchService.
Alfresco Solr SearchService.query() error parsing Xpath
Upvotes: 0