java - CUBA-Platform + EmailInfo - How to specify FTL template path under WEB-INF? -
i have email.ftl
under modules/portal/web/web-inf/templates/email/ (a subfolder created). in controller code, have emailinfo declaration, , want specify path email.ftl.
looking @ this tutorial, see emailinfo declaration this:
emailinfo emailinfo = new emailinfo( "john.doe@company.com,jane.roe@company.com", newsitem.getcaption(), null, "com/company/demo/templates/news_item.txt", collections.singletonmap("newsitem", newsitem) );
i notice relative path leading news_item.txt starts com/
leads me believe root of path starts "src" folder of module controller in (my controller in app-portal, in case, portal/src
). since template under web/
, not src/
, specified path so:
emailinfo emailinfo = new emailinfo("email@email.com", "email template", null, "../web/web-inf/templates/email/email.ftl", null, null);[/pre]
however, didn't work, error thrown:
java.lang.illegalargumentexception: not find template path: ../web/web-inf/templates/email/email.ftl
so question is, how specify file path go under different subfolder, "modules/portal/web"?
thanks, mingle
==x-posted cuba-platform forum==
thanks yuriy artamonov on cuba-platform answering:
unfortunately, cannot store email templates in portal / web modules, since processed on middleware. recommend put them core module src folder. in fact, "/" means class-path root, not folder.
templates loaded emailer using resources interface loads resources using following rules: https://doc.cuba-platform.com/manual-6.5/resources.html
i put email.ftl
under modules/core/src/com/example/test/email/email.ftl
, specified path of /com/example/test/email/email.ftl
, worked.
Comments
Post a Comment