public IModel parse(final TemplateData ownerTemplate, final String template) { // We will be setting useCache to false because we don't want to pollute the cache with mere String // parsing done from here. Also, we are 'artificially' specifying it as nested even if we don't really // know if this fragment is exactly a nested text inside the template, but that's not really important... return this.configuration.getTemplateManager().parseString(ownerTemplate, template, 0, 0, this.templateMode, false); }
@Override protected void writeUnresolved(final Writer writer) throws IOException { this.context.getConfiguration().getTemplateManager().process(this.templateModel, this.context, writer); }
@Override protected String resolveText() { final Writer stringWriter = new FastStringWriter(); this.context.getConfiguration().getTemplateManager().process(this.templateModel, this.context, stringWriter); return stringWriter.toString(); }
/** * <p> * Completely clears the Template Cache. * </p> * <p> * If this method is called before the TemplateEngine has been initialized, * it causes its initialization. * </p> */ public void clearTemplateCache() { if (!this.initialized) { initialize(); } this.configuration.getTemplateManager().clearCaches(); }
/** * <p> * Clears the entry in the Template Cache for the specified * template, if it is currently cached. * </p> * <p> * If this method is called before the TemplateEngine has been initialized, * it causes its initialization. * </p> * * @param templateName the name of the template to be cleared from cache. */ public void clearTemplateCacheFor(final String templateName) { Validate.notNull(templateName, "Template name cannot be null"); if (!this.initialized) { initialize(); } this.configuration.getTemplateManager().clearCachesFor(templateName); }
final TemplateManager templateManager = this.configuration.getTemplateManager(); throttledTemplateProcessor = templateManager.parseAndProcessThrottled(templateSpec, context);
final TemplateManager templateManager = this.configuration.getTemplateManager(); templateManager.parseAndProcess(templateSpec, context, writer);
do { fragmentModel = configuration.getTemplateManager().parseStandalone( context, templateName, fragments,
private CharSequence inlineSwitchTemplateMode(final ITemplateContext context, final IText text) { final TemplateManager templateManager = context.getConfiguration().getTemplateManager(); final TemplateModel templateModel = templateManager.parseString( context.getTemplateData(), text.getText(), text.getLine(), text.getCol(), this.templateMode, true); if (!this.writeTextsToOutput) { final Writer stringWriter = new FastStringWriter(50); templateManager.process(templateModel, context, stringWriter); return stringWriter.toString(); } // If we can directly write to output (and text is an IText), we will use a LazyProcessingCharSequence return new LazyProcessingCharSequence(context, templateModel); }
private CharSequence inlineSwitchTemplateMode(final ITemplateContext context, final ICDATASection cdataSection) { final TemplateManager templateManager = context.getConfiguration().getTemplateManager(); /* * Notice we are ONLY processing the contents of the CDATA, because we know the target inlining * mode will not understand the CDATA (it will be textual) and we don't want it to mess around with * the CDATA's prefix and suffix. * * Note this will only be executed in markup modes (textual modes never fire "handleCDATASection" events), * so we are safe assuming the sizes of CDATA prefixes and suffixes in HTML/XML. */ final TemplateModel templateModel = templateManager.parseString( context.getTemplateData(), cdataSection.getContent(), cdataSection.getLine(), cdataSection.getCol() + 9, // +9 because of the prefix this.templateMode, true); final Writer stringWriter = new FastStringWriter(50); templateManager.process(templateModel, context, stringWriter); return stringWriter.toString(); }
private CharSequence inlineSwitchTemplateMode(final ITemplateContext context, final IComment comment) { final TemplateManager templateManager = context.getConfiguration().getTemplateManager(); /* * Notice we are ONLY processing the contents of the Comment, because we know the target inlining * mode will not understand the Comment (it will be textual) and we don't want it to mess around with * the Comment's prefix and suffix. * * Note this will only be executed in markup modes (textual modes never fire "handleComment" events), * so we are safe assuming the sizes of Comment prefixes and suffixes in HTML/XML. */ final TemplateModel templateModel = templateManager.parseString( context.getTemplateData(), comment.getContent(), comment.getLine(), comment.getCol() + 4, // +4 because of the prefix this.templateMode, true); final Writer stringWriter = new FastStringWriter(50); templateManager.process(templateModel, context, stringWriter); return stringWriter.toString(); }
final TemplateManager templateManager = context.getConfiguration().getTemplateManager();
configuration.getTemplateManager().parseString( context.getTemplateData(), unescapedTextStr,
configuration.getTemplateManager().process(fragmentModel, context, stringWriter);
final TemplateManager templateManager = context.getConfiguration().getTemplateManager();
@Override public void clearViewsCache() { ThymeleafViewResolver viewResolver = applicationContext.getBean(ThymeleafViewResolver.class); viewResolver.clearCache(); viewResolver.getTemplateEngine().getConfiguration().getTemplateManager().clearCaches(); } }