/** * <p> * Sets a new set of dialects for this template engine, referenced * by the prefixes they will be using. * </p> * <p> * This operation can only be executed before processing templates for the first * time. Once a template is processed, the template engine is considered to be * <i>initialized</i>, and from then on any attempt to change its configuration * will result in an exception. * </p> * * @param dialects the new map of {@link IDialect} objects to be used, referenced * by their prefixes. */ public void setDialectsByPrefix(final Map<String,IDialect> dialects) { Validate.notNull(dialects, "Dialect map cannot be null"); checkNotInitialized(); this.dialectConfigurations.clear(); for (final Map.Entry<String,IDialect> dialectEntry : dialects.entrySet()) { addDialect(dialectEntry.getKey(), dialectEntry.getValue()); } }
/** * <p> * Sets a new set of dialects for this template engine, all of them using * their default prefixes. * </p> * <p> * This operation can only be executed before processing templates for the first * time. Once a template is processed, the template engine is considered to be * <i>initialized</i>, and from then on any attempt to change its configuration * will result in an exception. * </p> * * @param dialects the new set of {@link IDialect} objects to be used. */ public void setDialects(final Set<IDialect> dialects) { Validate.notNull(dialects, "Dialect set cannot be null"); checkNotInitialized(); this.dialectConfigurations.clear(); for (final IDialect dialect : dialects) { addDialect(dialect); } }
/** * <p> * Sets an additional set of dialects for this template engine, all of them using * their default prefixes. * </p> * <p> * This operation can only be executed before processing templates for the first * time. Once a template is processed, the template engine is considered to be * <i>initialized</i>, and from then on any attempt to change its configuration * will result in an exception. * </p> * * @param additionalDialects the new set of {@link IDialect} objects to be used. * * @since 2.0.9 * */ public void setAdditionalDialects(final Set<IDialect> additionalDialects) { Validate.notNull(additionalDialects, "Dialect set cannot be null"); checkNotInitialized(); for (final IDialect dialect : additionalDialects) { addDialect(dialect); } }
@PostConstruct public void setupModule() { if ( templateEngine != null ) { templateEngine.addDialect( new DeviceDialect( applicationContext ) ); } }
private static void setCachable(ThymeleafTemplateEngine thEngine, Properties properties) { if (properties.containsKey(CACHE_ENABLED_PROPERTY)) { boolean cachable = Boolean.parseBoolean(properties.getProperty(CACHE_ENABLED_PROPERTY)); TemplateEngine te = thEngine.getThymeleafTemplateEngine(); ConditionalCommentsDialect ccd = new ConditionalCommentsDialect(); te.addDialect(ccd); Set<ITemplateResolver> trs = te.getTemplateResolvers(); for (ITemplateResolver tr : trs) { ((TemplateResolver) tr).setCacheable(cachable); } } }
/** * Initializes and sets the template resolver */ private void initialize(ITemplateResolver templateResolver) { templateEngine = new org.thymeleaf.TemplateEngine(); templateEngine.setTemplateResolver(templateResolver); templateEngine.addDialect(new Java8TimeDialect()); }
/** * Initializes and sets the template resolver */ private void initialize(ITemplateResolver templateResolver) { templateEngine = new org.thymeleaf.TemplateEngine(); templateEngine.setTemplateResolver(templateResolver); templateEngine.addDialect(new Java8TimeDialect()); }
public ThymeleafMessageBodyWriter(@Context UriInfo uriInfo) { this.uriInfo = uriInfo; ClassPathTemplateResolver templateResolver = new ClassPathTemplateResolver(); templateResolver.setTemplateMode("HTML5"); templateResolver.setSuffix(ThymeleafViewFactory.TAIL); templateResolver.setPrefix(ThymeleafViewFactory.ROOT); templateResolver.setCacheable(false); engine = new TemplateEngine(); engine.setTemplateResolver(templateResolver); engine.addDialect(new Java8TimeDialect()); }
public ThymeleafMessageBodyWriter(@Context UriInfo uriInfo) { this.uriInfo = uriInfo; ClassPathTemplateResolver templateResolver = new ClassPathTemplateResolver(); templateResolver.setTemplateMode("HTML5"); templateResolver.setSuffix(ThymeleafViewFactory.TAIL); templateResolver.setPrefix(ThymeleafViewFactory.ROOT); templateResolver.setCacheable(false); engine = new TemplateEngine(); engine.setTemplateResolver(templateResolver); engine.addDialect(new Java8TimeDialect()); }
public ThymeleafMessageBodyWriter(@Context UriInfo uriInfo) { this.uriInfo = uriInfo; ClassPathTemplateResolver templateResolver = new ClassPathTemplateResolver(); templateResolver.setTemplateMode("HTML5"); templateResolver.setSuffix(ThymeleafViewFactory.TAIL); templateResolver.setPrefix(ThymeleafViewFactory.ROOT); templateResolver.setCacheable(false); engine = new TemplateEngine(); engine.setTemplateResolver(templateResolver); engine.addDialect(new Java8TimeDialect()); }
public ThymeleafMessageBodyWriter(@Context UriInfo uriInfo) { this.uriInfo = uriInfo; ClassPathTemplateResolver templateResolver = new ClassPathTemplateResolver(); templateResolver.setTemplateMode("HTML5"); templateResolver.setSuffix(ThymeleafViewFactory.TAIL); templateResolver.setPrefix(ThymeleafViewFactory.ROOT); templateResolver.setCacheable(false); engine = new TemplateEngine(); engine.setTemplateResolver(templateResolver); engine.addDialect(new Java8TimeDialect()); }
templateEngine.setTemplateResolver(templateResolver); templateEngine.setMessageResolver(new SegradaMessageResolver(servletContext)); templateEngine.addDialect(new SegradaDialect());