Package play.twirl.api

Examples of play.twirl.api.Content


        assertThat(a).isEqualTo(2);
    }

    @Test
    public void renderTemplate() {
        Content html = views.html.index.render("Your new application is ready.");
        assertThat(contentType(html)).isEqualTo("text/html");
        assertThat(contentAsString(html)).contains("Your new application is ready.");
    }
View Full Code Here


   *
   * @param context The current request context
   * @return The formatted unauthorized page
   */
  protected Content unauthorized(Context context) {
    return new Content() {

      @Override
      public String body() {
        return "Go away, you don't exit.";
      }
View Full Code Here

    return list(0);
  }
 
  @Override
  protected Content render(String template, Parameters params) {
    Content content;
    try {
      content = call("views.html." + template, "render", params);
    } catch (ClassNotFoundException | MethodNotFoundException e) {
      if (log.isDebugEnabled())
        log.debug("template not found : '" + template + "'");
View Full Code Here

  protected Result badRequest(String template, Parameters params) {
    return badRequest(render(template, params));
  }

  protected Content render(String template, Parameters params) {
    Content content;
    try {
      content = call("views.html." + template, "render", params);
    } catch (ClassNotFoundException | MethodNotFoundException e) {
      if (log.isDebugEnabled())
        log.debug("template not found : '" + template + "'");
View Full Code Here

        assertThat(a).isEqualTo(2);
    }

    @Test
    public void renderTemplate() {
        Content html = views.html.index.render("Your new application is ready.");
        assertThat(contentType(html)).isEqualTo("text/html");
        assertThat(contentAsString(html)).contains("Your new application is ready.");
    }
View Full Code Here

        assertEquals(2, a);
    }

    @Test
    public void renderTemplate() {
        Content html = views.html.index.render("Your new application is ready.");
        assertEquals("text/html", contentType(html));
        assertTrue(contentAsString(html).contains("Your new application is ready."));
    }
View Full Code Here

  //#test-controller-routes
 
  //#test-template
  @Test
  public void renderTemplate() {
    Content html = javaguide.tests.html.index.render("Welcome to Play!");
    assertEquals("text/html", contentType(html));
    assertTrue(contentAsString(html).contains("Welcome to Play!"));
  }
View Full Code Here

TOP

Related Classes of play.twirl.api.Content

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.