[stringtemplate-interest] ST4 with JBoss

Udo Borkowski ub at abego-software.de
Sat May 21 05:21:35 PDT 2011


I changed the STGroupDir code so it no longer looks for the ".stg", i.e. it should not raise the IOException.

This should fix the issue with JBoss as long as simple template names are used (like "viewport"). Accessing "hierarchical template names" like

> ST view = stg.getInstanceOf("web/viewport");


will still fail. Also covering these kind of names will require more effort (see private conversation).

Since I have no JBoss installation available I couldn't test this. Please use the daily build to verify if it fixes your issue.

Udo


On 19.05.2011, at 10:52, Bellentani Francesco wrote:

> 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 urlis vfszip:/C:/Progetti/server/EnterprisePlatform-5.0.0.GA/jboss-as/server/default/deploy/tol-web.war/WEB-INF/classes/templates/standard/.stg) and in case of FileNotFoundException itgoes 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 file inside
> ST view = stg.getInstanceOf("viewport");
> view.add("widget", widget); // NullPointerException because view is null
>  
> Best regards,
> Francesco
>  
>  
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20110521/46f2226b/attachment.html 


More information about the stringtemplate-interest mailing list