@Bean
 public TemplateResolver templateResolver() {
   TemplateResolver templateResolver = new ClassLoaderTemplateResolver();
   templateResolver.setPrefix("views/");
   templateResolver.setSuffix(".html");
   templateResolver.setTemplateMode("HTML5");
   return templateResolver;
 }
 @Bean
 public TemplateResolver templateResolver() {
   TemplateResolver templateResolver = new ServletContextTemplateResolver();
   templateResolver.setPrefix("/WEB-INF/views/");
   templateResolver.setSuffix(".html");
   templateResolver.setTemplateMode("HTML5");
   return templateResolver;
 }
 @Bean
 public TemplateResolver templateResolver() {
   TemplateResolver templateResolver = new ServletContextTemplateResolver();
   templateResolver.setPrefix(VIEWS);
   templateResolver.setSuffix(".html");
   templateResolver.setTemplateMode("HTML5");
   templateResolver.setCacheable(false);
   return templateResolver;
 }
 /*
  * Configure Template Resolver - Thymeleaf
  */
 @Bean
 public TemplateResolver webTemplateResolver() {
   TemplateResolver templateResolver = new ServletContextTemplateResolver();
   templateResolver.setPrefix(TEMPLATE_RESOLVER_PREFIX);
   templateResolver.setSuffix(TEMPLATE_RESOLVER_SUFFIX);
   templateResolver.setTemplateMode(TEMPLATE_RESOLVER_TEMPLATE_MODE);
   templateResolver.setCharacterEncoding(TEMPLATE_RESOLVER_CHAR_ENCODING);
   templateResolver.setCacheable(false);
   return templateResolver;
 }
 @Bean
 public TemplateResolver taskTemplateResolver() {
   final TemplateResolver resolver = new TemplateResolver();
   resolver.setPrefix(this.storageService.getStoragePath());
   resolver.setSuffix(".html");
   resolver.setTemplateMode("HTML5");
   resolver.setOrder(3);
   resolver.setCacheable(false);
   resolver.setCharacterEncoding("UTF-8");
   resolver.setResourceResolver(new OlympusCustomThymeleafResourceResolver());
   return resolver;
 }
 @Bean
 public TemplateResolver customTemplateResolver() {
   if (StringUtils.isEmpty(this.customPagesPath)) {
     return null;
   }
   final TemplateResolver resolver = new TemplateResolver();
   resolver.setPrefix(this.customPagesPath);
   resolver.setSuffix(".html");
   resolver.setTemplateMode("HTML5");
   resolver.setOrder(4);
   resolver.setCacheable(false);
   resolver.setCharacterEncoding("UTF-8");
   resolver.setResourceResolver(new FileResourceResolver());
   return resolver;
 }
Exemple #7
0
  public void setResponse(Pair<ABSString, ABS.StdLib.List<ABSValue>> pair) throws Exception {
    TemplateResolver templateResolver = new TemplateResolver();
    templateResolver.setTemplateMode("HTML5");
    templateResolver.setSuffix(".html");
    templateResolver.setResourceResolver(new ResourceResolver());

    TemplateEngine templateEngine = new TemplateEngine();
    templateEngine.setTemplateResolver(templateResolver);

    List_Cons<ABSValue> data;

    if (pair != null) {
      String view = DataTransformer.convertABSStringToJavaString((ABSString) pair.getArg(0));
      Context ctx = new Context();
      if (!(pair.getArg(1) instanceof List_Nil)) {
        data = (List_Cons<ABSValue>) pair.getArg(1);
        ArrayList<Object> dataModels = DataTransformer.convertABSListToJavaList(data);

        if (dataModels.size() > 1) {
          ctx.setVariable("dataList", dataModels);
        } else {
          ctx.setVariable("data", dataModels.get(0));
        }
      }
      ctx.setVariable("requestMethod", this.request.getMethod());
      ctx.setVariable("requestURI", this.request.getRequestURI());
      ctx.setVariable("requestContextPath", this.request.getContextPath());
      ctx.setVariable(
          "requestRoute", this.getRoute(request.getRequestURI(), request.getContextPath()));

      this.response = templateEngine.process(view, ctx);
    } else {
      this.response = "<h3>ERROR 404: PAGE NOT FOUND</h3>";
      this.response += "<span style='font-size:0.8em;'>ABS Server: " + new Date() + "</span><br />";
    }
  }