AnsweredAssumed Answered

Include directive to include FTL in webscript's FTL

Question asked by fstnboy on Sep 28, 2011
Latest reply on Oct 3, 2011 by fstnboy
Hi all,

Let's see if someone can help me.

I've got a web script defined in Data Dictionary/Web Scripts Extensions/com/test

I tested the freemarker include directive with header and footer FTLs in the same directory and it works. Tested putting them somewhere else in the repository but cannot get them…

my webscript FTL looks like this:

<#assign homePageFTL = "Data Dictionary/Templates/com/homePage.ftl"/>

<#if companyhome.childByNamePath["${homePageFTL}"]?exists>
       <#include companyhome. childByNamePath["${homePageFTL}"].nodeRef />
</#if>

I'm getting the following error….
07:17:05,274  ERROR [extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 08280014 Wrapped Exception (with status template): 08280373 Error during processing of the template 'Error reading included file workspace://SpacesStore/ec225803-80ce-47ae-a033-42fd1f6719b3'. Please contact your system administrator.
org.springframework.extensions.webscripts.WebScriptException: 08280014 Wrapped Exception (with status template): 08280373 Error during processing of the template 'Error reading included file workspace://SpacesStore/ec225803-80ce-47ae-a033-42fd1f6719b3'. Please contact your system administrator.
   at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:759)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:171)
   at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:383)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:381)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:436)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:466)
   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:304)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:352)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)
   at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Thread.java:680)
Caused by: org.alfresco.service.cmr.repository.TemplateException: 08280373 Error during processing of the template 'Error reading included file workspace://SpacesStore/ec225803-80ce-47ae-a033-42fd1f6719b3'. Please contact your system administrator.
   at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:206)
   at org.springframework.extensions.webscripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:590)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:267)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:147)
   … 24 more
Caused by: freemarker.template.TemplateException: Error reading included file workspace://SpacesStore/ec225803-80ce-47ae-a033-42fd1f6719b3
   at freemarker.core.Include.accept(Include.java:167)
   at freemarker.core.Environment.visit(Environment.java:221)
   at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
   at freemarker.core.Environment.visit(Environment.java:221)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:221)
   at freemarker.core.Environment.process(Environment.java:199)
   at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:202)
   … 27 more
Caused by: java.io.FileNotFoundException: Template workspace://SpacesStore/ec225803-80ce-47ae-a033-42fd1f6719b3 not found.
   at freemarker.template.Configuration.getTemplate(Configuration.java:495)
   at freemarker.core.Environment.getTemplateForInclusion(Environment.java:1490)
   at freemarker.core.Include.accept(Include.java:157)
   … 34 more

I've checked that the nodeRef shown in the error is fine, and it is.

How can I include an FTL which is in a certain path in the webscript's FTL?

Thanks

Outcomes