[jboss-dev-forums] [JBoss AS 7 Development] - Possible ThymeLeaf Integration

Ondrej Zizka do-not-reply at jboss.com
Sun Dec 9 14:52:50 EST 2012


Ondrej Zizka [https://community.jboss.org/people/ozizka] modified the document:

"Possible ThymeLeaf Integration"

To view the document, visit: https://community.jboss.org/docs/DOC-48038

--------------------------------------------------------------
ThymeLeaf is a templating engine.
 http://www.thymeleaf.org/documentation.html http://www.thymeleaf.org/documentation.html

h2. Possible integration points
h4. In CDI, even standalone:

*  http://www.thymeleaf.org/apidocs/thymeleaf/2.0.14/org/thymeleaf/context/IContext.html IContext - the map of values available for the template. Those could be resolved from CDI.* @Inject CDIThymeContext;


*  http://www.thymeleaf.org/apidocs/thymeleaf/2.0.14/org/thymeleaf/messageresolver/IMessageResolver.html IMessageResolver - use CDI for loading messages.

* 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 

h4. Additionally, in Application Server: 

*  http://www.thymeleaf.org/apidocs/thymeleaf/2.0.14/org/thymeleaf/resourceresolver/IResourceResolver.html IResourceResolver - to load resources from deployments. ThymeLeaf's ClassLoaderResourceResolver uses just
 ClassLoaderUtils.getClassLoader(ClassLoaderResourceResolver.class).getResourceAsStream(resourceName);


*  http://www.thymeleaf.org/apidocs/thymeleaf/2.0.14/org/thymeleaf/cache/ICacheManager.html ICacheManager - use InfiniSpan as cache.

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

Comment by going to Community
[https://community.jboss.org/docs/DOC-48038]

Create a new document in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2225]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20121209/095dba40/attachment-0001.html 


More information about the jboss-dev-forums mailing list