/** * <p> * Sets a new (optional) prefix to be added to all template names in order * to convert <i>template names</i> into <i>resource names</i>. * </p> * * @param prefix the prefix to be set. */ public void setPrefix(final String prefix) { checkNotInitialized(); this.prefix = prefix; }
/** * <p> * Sets a new character encoding for reading template resources. * </p> * * @param characterEncoding the character encoding to be used. */ public void setCharacterEncoding(final String characterEncoding) { checkNotInitialized(); this.characterEncoding = characterEncoding; }
/** * <p> * Sets a new (optional) suffix to be added to all template names in order * to convert <i>template names</i> into <i>resource names</i>. * </p> * * @param suffix the suffix to be set. */ public void setSuffix(final String suffix) { checkNotInitialized(); this.suffix = suffix; }
/** * <p> * Sets the resource resolver to be included into {@link TemplateResolution} results. * </p> * * @param resourceResolver the new resource resolver. */ public void setResourceResolver(final IResourceResolver resourceResolver) { checkNotInitialized(); this.resourceResolver = resourceResolver; }
/** * <p> * Sets a new value for the cache TTL for resolved templates. * </p> * <p> * If a template is resolved as <i>cacheable</i> but cache TTL is null, * this means the template will live in cache until evicted by LRU * (Least Recently Used) algorithm for being the oldest entry in cache. * </p> * * @param cacheTTLMs the new cache TTL, or null for using natural LRU eviction. */ public void setCacheTTLMs(final Long cacheTTLMs) { checkNotInitialized(); this.cacheTTLMs = cacheTTLMs; }
/** * <p> * Sets a new value for the <i>cacheable</i> flag. * </p> * <p> * If <i>cacheable patterns</i> (see {@link #setCacheablePatterns(Set)}) * are also set, they have higher priority than the value set here (this * would act as a <i>default</i>). * </p> * * @param cacheable whether resolved patterns should be considered cacheable or not. */ public void setCacheable(final boolean cacheable) { checkNotInitialized(); this.cacheable = cacheable; }
/** * <p> * Removes all currently configured template aliases. * </p> */ public void clearTemplateAliases() { checkNotInitialized(); this.templateAliases.clear(); }
/** * <p> * Sets all the new template aliases to be used. * </p> * <p> * Template aliases allow the use of several (and probably shorter) * names for templates. * </p> * <p> * Aliases are applied to template names <b>before</b> prefix/suffix. * </p> * * @param templateAliases the new template aliases. */ public void setTemplateAliases(final Map<String,String> templateAliases) { checkNotInitialized(); if (templateAliases != null) { this.templateAliases.putAll(templateAliases); } }
/** * <p> * Sets the new <i>patterns</i> to be applied for establishing the VALIDXHTML (validated XHTML) * template mode as Strings. * </p> * <p> * This is a convenience method equivalent to {@link #getValidXhtmlTemplateModePatternSpec()}.setPatterns(Set<String>) * </p> * * @param newValidXhtmlTemplatesModePatterns the new patterns */ public final void setValidXhtmlTemplateModePatterns(final Set<String> newValidXhtmlTemplatesModePatterns) { checkNotInitialized(); this.validXhtmlTemplateModePatternSpec.setPatterns(newValidXhtmlTemplatesModePatterns); }
/** * <p> * Sets the new <i>patterns</i> to be applied for establishing the XHTML * template mode as Strings. * </p> * <p> * This is a convenience method equivalent to {@link #getXhtmlTemplateModePatternSpec()}.setPatterns(Set<String>) * </p> * * @param newXhtmlTemplatesModePatterns the new patterns */ public final void setXhtmlTemplateModePatterns(final Set<String> newXhtmlTemplatesModePatterns) { checkNotInitialized(); this.xhtmlTemplateModePatternSpec.setPatterns(newXhtmlTemplatesModePatterns); }
/** * <p> * Sets the new <i>patterns</i> to be applied for establishing the XML * template mode as Strings. * </p> * <p> * This is a convenience method equivalent to {@link #getXmlTemplateModePatternSpec()}.setPatterns(Set<String>) * </p> * * @param newXmlTemplatesModePatterns the new patterns */ public final void setXmlTemplateModePatterns(final Set<String> newXmlTemplatesModePatterns) { checkNotInitialized(); this.xmlTemplateModePatternSpec.setPatterns(newXmlTemplatesModePatterns); }
/** * <p> * Sets the new <i>patterns</i> to be applied for establishing the VALIDXML (validated XML) * template mode as Strings. * </p> * <p> * This is a convenience method equivalent to {@link #getValidXmlTemplateModePatternSpec()}.setPatterns(Set<String>) * </p> * * @param newValidXmlTemplatesModePatterns the new patterns */ public final void setValidXmlTemplateModePatterns(final Set<String> newValidXmlTemplatesModePatterns) { checkNotInitialized(); this.validXmlTemplateModePatternSpec.setPatterns(newValidXmlTemplatesModePatterns); }
/** * <p> * Sets the new <i>patterns</i> to be applied for establishing the LEGACYHTML5 (non-XML-formed HTML5 that needs HTML-to-XML conversion) * template mode as Strings. * </p> * <p> * This is a convenience method equivalent to {@link #getLegacyHtml5TemplateModePatternSpec()}.setPatterns(Set<String>) * </p> * * @param newLegacyHtml5TemplatesModePatterns the new patterns */ public final void setLegacyHtml5TemplateModePatterns(final Set<String> newLegacyHtml5TemplatesModePatterns) { checkNotInitialized(); this.legacyHtml5TemplateModePatternSpec.setPatterns(newLegacyHtml5TemplatesModePatterns); }
/** * <p> * Sets the new <i>patterns</i> to be applied for establishing the HTML5 (correct, XML-formed HTML5) * template mode as Strings. * </p> * <p> * This is a convenience method equivalent to {@link #getHtml5TemplateModePatternSpec()}.setPatterns(Set<String>) * </p> * * @param newHtml5TemplatesModePatterns the new patterns */ public final void setHtml5TemplateModePatterns(final Set<String> newHtml5TemplatesModePatterns) { checkNotInitialized(); this.html5TemplateModePatternSpec.setPatterns(newHtml5TemplatesModePatterns); }
/** * <p> * Sets the new <i>patterns</i> to be applied for establishing which * templates have to be considered <i>cacheable</i> * </p> * <p> * These patterns have higher precedence than the <i>cacheable</i> * flag (see {@link #setCacheable(boolean)}). Such flag can be considered * a <i>default value</i> after <i>cacheable patterns</i> and * <i>non-cacheable patterns</i> have been applied. * </p> * <p> * This is a convenience method equivalent to {@link #getCacheablePatternSpec()}.setPatterns(Set<String>) * </p> * * @param cacheablePatterns the new patterns */ public final void setCacheablePatterns(final Set<String> cacheablePatterns) { checkNotInitialized(); this.cacheablePatternSpec.setPatterns(cacheablePatterns); }
/** * <p> * Sets the template mode to be applied to templates resolved by this resolver. * </p> * <p> * The set of available template modes is variable, as these can be established * by the user by means of adding {@link org.thymeleaf.templatemode.TemplateModeHandler} * objects to the engine. Nevertheless, there is a <i>standard</i> set of * template modes defined by the {@link StandardTemplateModeHandlers} class. * </p> * <p> * If <i>template mode patterns</i> (see {@link #setXhtmlTemplateModePatterns(Set)}, * {@link #setHtml5TemplateModePatterns(Set)}, etc.) are also set, they have higher * priority than the template mode set here (this would act as a <i>default</i>). * </p> * * @param templateMode the template mode. */ public void setTemplateMode(final String templateMode) { checkNotInitialized(); Validate.notNull(templateMode, "Cannot set a null template mode value"); this.templateMode = templateMode; }
/** * <p> * Adds a new template alias to the currently configured ones. * </p> * * @param alias the new alias name * @param templateName the name of the template the alias will be applied to */ public void addTemplateAlias(final String alias, final String templateName) { checkNotInitialized(); Validate.notNull(alias, "Alias cannot be null"); Validate.notNull(templateName, "Template name cannot be null"); this.templateAliases.put(alias, templateName); }
/** * <p> * Sets the new <i>patterns</i> to be applied for establishing which * templates have to be considered <i>non cacheable</i> * </p> * <p> * These patterns have higher precedence than the <i>cacheable</i> * flag (see {@link #setCacheable(boolean)}). Such flag can be considered * a <i>default value</i> after <i>cacheable patterns</i> and * <i>non-cacheable patterns</i> have been applied. * </p> * <p> * This is a convenience method equivalent to {@link #getNonCacheablePatternSpec()}.setPatterns(Set<String>) * </p> * * @param nonCacheablePatterns the new patterns */ public final void setNonCacheablePatterns(final Set<String> nonCacheablePatterns) { checkNotInitialized(); this.nonCacheablePatternSpec.setPatterns(nonCacheablePatterns); }