JBoss Community

Possible ThymeLeaf Integration

modified by Ondrej Zizka in JBoss AS 7 Development - View the full document

ThymeLeaf is a templating engine.

http://www.thymeleaf.org/documentation.html

 

Possible integration points

In CDI, even standalone:

 

  • IContext - the map of values available for the template. Those could be resolved from CDI.
    • @Inject CDIThymeContext;

 

 

  • Also, we could make the template names type-safe, by introducing one qualifier per page.
          @Inject @Template @Home  ThymeTemplate tpl;
 
          // Additional variable
          tpl.getContext().setVariable("foo", bar);
          tpl.process( response.getWriter() );

          This would

 

Additionally, in Application Server:

 

  • IResourceResolver - to load resources from deployments. ThymeLeaf's ClassLoaderResourceResolver uses just
 ClassLoaderUtils.getClassLoader(ClassLoaderResourceResolver.class).getResourceAsStream(resourceName);

 

 

  • @Resource TemplateEngine templateEngine;   - inject template engine configured as module.

Comment by going to Community

Create a new document in JBoss AS 7 Development at Community