[stringtemplate-interest] ST4 with JBoss

Bellentani Francesco bellentani at cadit.it
Thu May 19 01:52:57 PDT 2011


Hi,
I'm using ST4 in a webapp under JBoss, and my templates are in a
directory (in the classpath) without .stg file.
The STGroupDir class, method @Override protected CompiledST load(String
name) at line 122 try to open the stream to the .stg file (in my case
the url is
vfszip:/C:/Progetti/server/EnterprisePlatform-5.0.0.GA/jboss-as/server/d
efault/deploy/tol-web.war/WEB-INF/classes/templates/standard/.stg
<http://enterpriseplatform-5.0.0.ga/jboss-as/server/default/deploy/tol-w
eb.war/WEB-INF/classes/templates/standard/.stg> ) and in case of
FileNotFoundException it goes to the .st load.
Unfortunately the JBoss vfszip protocol implementation throws a
"java.io.IOException: Child not found
tol-web.war/WEB-INF/classes/templates/standard/.stg/ for [a lot of
FileHandlers]..." and not a FileNotFoundException, this results in a
null template also if the .st file exists.
 
My code:
STGroup stg = new STGroupDir("/templates/standard", '$', '$'); //
/template/standard is a folder in the classpath with a viewport.st
<http://viewport.st/>  file inside
ST view = stg.getInstanceOf("viewport");
view.add("widget", widget); // NullPointerException because view is null
 
Best regards,
Francesco
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20110519/011475dc/attachment-0001.html 


More information about the stringtemplate-interest mailing list