Java Code Examples for org.thymeleaf.templateresource.StringTemplateResource

The following examples show how to use org.thymeleaf.templateresource.StringTemplateResource. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: oxygen   Source File: ThymeleafViewResultHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected ITemplateResource computeTemplateResource(IEngineConfiguration configuration,
    String ownerTemplate, String template, Map<String, Object> templateResolutionAttributes) {
  if (isCacheable()) {
    return new StringTemplateResource(Templates.cachedTemplate(prefix + template));
  }
  return new StringTemplateResource(Templates.template(prefix + template));
}
 
Example 2
Source Project: vertx-web   Source File: ThymeleafTemplateEngineImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected ITemplateResource computeTemplateResource(IEngineConfiguration configuration, String ownerTemplate, String template, Map<String, Object> templateResolutionAttributes) {
  return new StringTemplateResource(
    vertx.fileSystem()
      .readFileBlocking(template)
      .toString(Charset.defaultCharset()));
}
 
Example 3
public void addForm(String templateName, String templateContent) {
    templates.put(templateName, new StringTemplateResource(templateContent));
    templateEngine.getCacheManager().clearAllCaches();
}
 
Example 4
public void addForm(String templateName, String templateContent) {
    templates.put(templateName, new StringTemplateResource(templateContent));
    templateEngine.getCacheManager().clearAllCaches();
}