Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
moqui
/
moqui-mjml
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
bb08ed19
authored
2024-05-16 17:30:31 -0500
by
acetousk
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Try using a string instead of location for ftl rendering to avoid creating a temporary dbresource.
1 parent
755febc4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 deletions
service/mjml/MjmlServices.xml
service/mjml/MjmlServices.xml
View file @
bb08ed1
...
...
@@ -125,11 +125,28 @@ along with this software (see the LICENSE.md file). If not, see
}
]]>
</script>
<!-- <log level="warn" message="dataPre is ${dataPre}"/>-->
<set
field=
"grapesTempFile"
from=
"grapesJsResource.makeFile(grapesFile?.dbResourceId + '.temp.json')"
/>
<script>
grapesTempFile.putText(dataPre)
</script>
<set
field=
"data"
from=
"ec.resource.template(grapesTempFile.location, 'ftl')"
/>
<script>
grapesTempFile.delete()
</script>
<!-- <log level="warn" message="data is ${data}"/>-->
<script>
<![CDATA[
String location = "template.ftl";
freemarker.template.Template newTemplate;
Reader templateReader = null;
try {
templateReader = new StringReader(context.dataPre);
// Use the getFtlConfiguration method from ec.resource.templateRenderers.ftl
newTemplate = new freemarker.template.Template(location, templateReader, ec.resource.templateRenderers.ftl.getFtlConfiguration());
} catch (Exception e) {
throw new org.moqui.BaseArtifactException("Error while initializing template at " + location, e);
} finally {
if (templateReader != null) {
try { templateReader.close(); }
catch (Exception e) { logger.error("Error closing template reader", e); }
}
}
context.data = newTemplate.toString();
]]>
</script>
<!-- <set field="data" from="ec.resource.template(grapesTempFile.location, 'ftl')"/>-->
<log
level=
"warn"
message=
"data is ${data}"
/>
<set
field=
"moquiVars"
from=
"globalGrapeVarList"
/>
</else-if>
<else>
...
...
Please
register
or
sign in
to post a comment