Package org.thymeleaf.templateresolver

Examples of org.thymeleaf.templateresolver.TemplateResolver


      throw new ConfigurationException("Can not load property file " + propFileName, e);
    }

    {
      myProfileTemplateEngine = new TemplateEngine();
      TemplateResolver resolver = new TemplateResolver();
      resolver.setResourceResolver(new ProfileResourceResolver());
      myProfileTemplateEngine.setTemplateResolver(resolver);
      StandardDialect dialect = new StandardDialect();
      HashSet<IProcessor> additionalProcessors = new HashSet<IProcessor>();
      additionalProcessors.add(new NarrativeAttributeProcessor());
      dialect.setAdditionalProcessors(additionalProcessors);
      myProfileTemplateEngine.setDialect(dialect);
      myProfileTemplateEngine.initialize();
    }
    {
      myTitleTemplateEngine = new TemplateEngine();
      TemplateResolver resolver = new TemplateResolver();
      resolver.setResourceResolver(new TitleResourceResolver());
      myTitleTemplateEngine.setTemplateResolver(resolver);
      StandardDialect dialect = new StandardDialect();
      HashSet<IProcessor> additionalProcessors = new HashSet<IProcessor>();
      additionalProcessors.add(new NarrativeAttributeProcessor());
      dialect.setAdditionalProcessors(additionalProcessors);
View Full Code Here


  @SuppressWarnings("UnusedDeclaration")
  @Provides
  @Singleton
  ITemplateResolver provideTemplateResolver(LaunchConfig launchConfig) {
    IResourceResolver resourceResolver = new FileSystemBindingThymeleafResourceResolver(launchConfig.getBaseDir());
    TemplateResolver templateResolver = new TemplateResolver();
    templateResolver.setResourceResolver(resourceResolver);


    String mode = templatesMode == null ? launchConfig.getOther("thymeleaf.templatesMode", DEFAULT_TEMPLATE_MODE) : templatesMode;
    templateResolver.setTemplateMode(mode);

    String prefix = templatesPrefix == null ? launchConfig.getOther("thymeleaf.templatesPrefix", DEFAULT_TEMPLATE_PREFIX) : templatesPrefix;
    if (!prefix.endsWith(File.separator)) {
      prefix += File.separator;
    }
    templateResolver.setPrefix(prefix);

    String suffix = templatesSuffix == null ? launchConfig.getOther("thymeleaf.templatesSuffix", DEFAULT_TEMPLATE_SUFFIX) : templatesSuffix;
    if (suffix.equalsIgnoreCase("")) {
      suffix = DEFAULT_TEMPLATE_SUFFIX;
    }
    templateResolver.setSuffix(suffix);

    Integer cacheSize = getCacheSizeSetting(launchConfig);
    templateResolver.setCacheable(cacheSize > 0);

    // Never use TTL expiration
    templateResolver.setCacheTTLMs(null);

    return templateResolver;
  }
View Full Code Here

    return templateEngine;
  }

  @Bean
  public TemplateResolver templateResolver() {
    TemplateResolver templateResolver = new ClassLoaderTemplateResolver();
    templateResolver.setPrefix("/views/");
    templateResolver.setSuffix(".html");
    templateResolver.setTemplateMode("HTML5");
    return templateResolver;
  }
View Full Code Here

    return templateEngine;
  }

  @Bean
  public TemplateResolver templateResolver() {
    TemplateResolver templateResolver = new ClassLoaderTemplateResolver();
    templateResolver.setPrefix("/views/");
    templateResolver.setSuffix(".html");
    templateResolver.setTemplateMode("HTML5");
    return templateResolver;
  }
View Full Code Here

    return templateEngine;
  }

  @Bean
  public TemplateResolver templateResolver() {
    TemplateResolver templateResolver = new ServletContextTemplateResolver();
    templateResolver.setPrefix("/WEB-INF/views/");
    templateResolver.setSuffix(".html");
    templateResolver.setTemplateMode("HTML5");
    return templateResolver;
  }
View Full Code Here

    return templateEngine;
  }

  @Bean
  public TemplateResolver templateResolver() {
    TemplateResolver templateResolver = new ClassLoaderTemplateResolver();
    templateResolver.setPrefix("/views/");
    templateResolver.setSuffix(".html");
    templateResolver.setTemplateMode("HTML5");
    return templateResolver;
  }
View Full Code Here

        String suffix = ".thtml";

        LOG.info( "Registering development Thymeleaf lookup for {} with physical path {}", views.getKey(),
                  views.getValue() );

        TemplateResolver resolver = new SpringResourceTemplateResolver();
        resolver.setOrder( 19 );
        resolver.setCharacterEncoding( "UTF-8" );
        resolver.setTemplateMode( "HTML5" );
        resolver.setCacheable( false );
        resolver.setPrefix( prefix );
        resolver.setSuffix( suffix );

        applicationContext.getAutowireCapableBeanFactory().initializeBean( resolver,
                                                                           "developmentResolver." + views
                                                                               .getKey() );
View Full Code Here

  }

  @Bean
  @Exposed
  public TemplateResolver templateResolver() {
    TemplateResolver resolver = new SpringResourceTemplateResolver();
    resolver.setCharacterEncoding( "UTF-8" );
    resolver.setTemplateMode( "HTML5" );
    resolver.setCacheable( !developmentMode.isActive() );
    resolver.setPrefix( "classpath:/views/" );
    resolver.setSuffix( ".thtml" );
    resolver.setOrder( 20 );

    return resolver;
  }
View Full Code Here

TOP

Related Classes of org.thymeleaf.templateresolver.TemplateResolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.