Package org.thymeleaf

Examples of org.thymeleaf.TemplateEngine.process()


        }
        if (templateCharacterEncoding != null) {
            response.setCharacterEncoding(templateCharacterEncoding);
        }
       
        viewTemplateEngine.process(templateName, context, templateFragmentSpec, response.getWriter());
       
    }


View Full Code Here


        }
        if (templateCharacterEncoding != null) {
            response.setCharacterEncoding(templateCharacterEncoding);
        }
       
        viewTemplateEngine.process(templateName, context, templateFragmentSpec, response.getWriter());
       
    }


View Full Code Here

    this.context.register(ThymeleafAutoConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    TemplateEngine engine = this.context.getBean(TemplateEngine.class);
    Context attrs = new Context(Locale.UK, Collections.singletonMap("foo", "bar"));
    String result = engine.process("template.txt", attrs);
    assertEquals("<html>bar</html>", result);
  }

  @Test
  public void overrideCharacterEncoding() throws Exception {
View Full Code Here

    this.context.register(ThymeleafAutoConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    TemplateEngine engine = this.context.getBean(TemplateEngine.class);
    Context attrs = new Context(Locale.UK, Collections.singletonMap("foo", "bar"));
    String result = engine.process("data-dialect", attrs);
    assertEquals("<html><body data-foo=\"bar\"></body></html>", result);
  }

  @Test
  public void renderTemplate() throws Exception {
View Full Code Here

    this.context.register(ThymeleafAutoConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    TemplateEngine engine = this.context.getBean(TemplateEngine.class);
    Context attrs = new Context(Locale.UK, Collections.singletonMap("foo", "bar"));
    String result = engine.process("home", attrs);
    assertEquals("<html><body>bar</body></html>", result);
  }

  @Test
  public void renderNonWebAppTemplate() throws Exception {
View Full Code Here

    assertEquals(0, context.getBeanNamesForType(ViewResolver.class).length);
    try {
      TemplateEngine engine = context.getBean(TemplateEngine.class);
      Context attrs = new Context(Locale.UK, Collections.singletonMap("greeting",
          "Hello World"));
      String result = engine.process("message", attrs);
      assertThat(result, containsString("Hello World"));
    }
    finally {
      context.close();
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.