Java Code Examples for de.neuland.jade4j.JadeConfiguration#setCaching()
The following examples show how to use
de.neuland.jade4j.JadeConfiguration#setCaching() .
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 File: JadeKrazoConfiguration.java From krazo with Apache License 2.0 | 6 votes |
@Produces @ViewEngineConfig JadeConfiguration produce() { loadConfig(); JadeConfiguration jade = new JadeConfiguration(); jade.setMode(Mode.valueOf(property(MODE).orElse("XHTML"))); jade.setCaching(Boolean.valueOf(property(CACHING).orElse("true"))); jade.setPrettyPrint(Boolean.valueOf(property(PRETTY_PRINT).orElse("false"))); getExtensions(FILTER_QUALIFIER).entrySet().forEach(filter -> { jade.setFilter(filter.getKey(), (Filter) filter.getValue()); }); jade.setSharedVariables(getExtensions(HELPER_QUALIFIER)); String encoding = property(ENCODING).orElse("UTF-8"); jade.setTemplateLoader(new ServletContextTemplateLoader(servletContext, encoding)); return jade; }
Example 2
Source File: JadeOzarkConfiguration.java From ozark with Apache License 2.0 | 6 votes |
@Produces @ViewEngineConfig JadeConfiguration produce() { loadConfig(); JadeConfiguration jade = new JadeConfiguration(); jade.setMode(Mode.valueOf(property(MODE).orElse("XHTML"))); jade.setCaching(Boolean.valueOf(property(CACHING).orElse("true"))); jade.setPrettyPrint(Boolean.valueOf(property(PRETTY_PRINT).orElse("false"))); getExtensions(FILTER_QUALIFIER).entrySet().forEach(filter -> { jade.setFilter(filter.getKey(), (Filter) filter.getValue()); }); jade.setSharedVariables(getExtensions(HELPER_QUALIFIER)); String encoding = property(ENCODING).orElse("UTF-8"); jade.setTemplateLoader(new ServletContextTemplateLoader(servletContext, encoding)); return jade; }
Example 3
Source File: JadeTemplateEngine.java From pippo with Apache License 2.0 | 6 votes |
@Override public void init(Application application) { super.init(application); Router router = getRouter(); PippoSettings pippoSettings = getPippoSettings(); configuration = new JadeConfiguration(); configuration.setTemplateLoader(new ClassTemplateLoader(JadeTemplateEngine.class, getTemplatePathPrefix())); configuration.setMode(Mode.HTML); if (pippoSettings.isDev()) { configuration.setPrettyPrint(true); configuration.setCaching(false); // disable cache } // set global template variables configuration.getSharedVariables().put("contextPath", router.getContextPath()); configuration.getSharedVariables().put("appPath", router.getApplicationPath()); // allow custom initialization init(application, configuration); }
Example 4
Source File: Jade4jTemplateConfiguration.java From apm-agent-java with Apache License 2.0 | 5 votes |
@Bean public JadeConfiguration jadeConfiguration() { JadeConfiguration configuration = new JadeConfiguration(); configuration.setCaching(false); configuration.setTemplateLoader(templateLoader()); return configuration; }
Example 5
Source File: JadeTemplateEngine.java From pippo with Apache License 2.0 | 5 votes |
@Override public void renderString(String templateContent, Map<String, Object> model, Writer writer) { // prepare the locale-aware i18n method String language = (String) model.get(PippoConstants.REQUEST_PARAMETER_LANG); if (StringUtils.isNullOrEmpty(language)) { language = getLanguageOrDefault(language); } // prepare the locale-aware prettyTime method Locale locale = (Locale) model.get(PippoConstants.REQUEST_PARAMETER_LOCALE); if (locale == null) { locale = getLocaleOrDefault(language); } model.put("pippo", new PippoHelper(getMessages(), language, locale, getRouter())); try (StringReader reader = new StringReader(templateContent)) { ReaderTemplateLoader stringTemplateLoader = new ReaderTemplateLoader(reader, "StringTemplate"); JadeConfiguration stringTemplateConfiguration = new JadeConfiguration(); stringTemplateConfiguration.setCaching(false); stringTemplateConfiguration.setTemplateLoader(stringTemplateLoader); stringTemplateConfiguration.setMode(configuration.getMode()); stringTemplateConfiguration.setPrettyPrint(configuration.isPrettyPrint()); JadeTemplate stringTemplate = configuration.getTemplate("StringTemplate"); configuration.renderTemplate(stringTemplate, model, writer); writer.flush(); } catch (Exception e) { throw new PippoRuntimeException(e); } }
Example 6
Source File: JadeTemplateConfiguration.java From tutorials with MIT License | 5 votes |
@Bean public JadeConfiguration jadeConfiguration() { JadeConfiguration configuration = new JadeConfiguration(); configuration.setCaching(false); configuration.setTemplateLoader(templateLoader()); return configuration; }
Example 7
Source File: WebMvcConfig.java From spring-comparing-template-engines with Apache License 2.0 | 5 votes |
@Bean public JadeConfiguration jadeConfiguration() { JadeConfiguration config = new JadeConfiguration(); config.setPrettyPrint(true); config.setCaching(false); config.setTemplateLoader(applicationContext.getBean(SpringTemplateLoader.class)); return config; }