当前位置: 首页>>代码示例>>Java>>正文


Java Content类代码示例

本文整理汇总了Java中play.twirl.api.Content的典型用法代码示例。如果您正苦于以下问题:Java Content类的具体用法?Java Content怎么用?Java Content使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Content类属于play.twirl.api包,在下文中一共展示了Content类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: render

import play.twirl.api.Content; //导入依赖的package包/类
@Override
public CompletionStage<Content> render(final PageContent pageContent, @Nullable final String templateName, @Nullable final String cmsKey) {
    final PageData pageData = pageDataFactory.create(pageContent);
    return hookRunner.waitForHookedComponentsToFinish()
            .thenComposeAsync(unused -> {
                PageDataReadyHook.runHook(hookRunner, pageData);
                logFinalPageData(pageData);
                return super.render(pageData, templateName, cmsKey);
            }, HttpExecution.defaultContext());
}
 
开发者ID:commercetools,项目名称:commercetools-sunrise-java,代码行数:11,代码来源:PageHtmlContentRenderer.java

示例2: renderTemplate

import play.twirl.api.Content; //导入依赖的package包/类
@Test
@Ignore
public void renderTemplate() {
    // If you are calling out to Assets, then you must instantiate an application
    // because it makes use of assets metadata that is configured from
    // the application.

    Content html = views.html.index.render("Your new application is ready.");
    assertThat("text/html").isEqualTo(html.contentType());
    assertThat(html.body()).contains("Your new application is ready.");
}
 
开发者ID:reljicd,项目名称:play-framework-blog,代码行数:12,代码来源:FunctionalTest.java

示例3: renderTest

import play.twirl.api.Content; //导入依赖的package包/类
@Test
public void renderTest() {
    running(fakeApplication(), () -> { // runnable
            Content html = views.html.index.render("", null);
            assertEquals("text/html", html.contentType());
            // email label
            assertTrue(contentAsString(html).contains(Messages.get("index.text.email")));
            // password label
            assertTrue(contentAsString(html).contains(Messages.get("index.text.password")));
            // on index is video
            assertTrue(contentAsString(html).contains("flex-video"));
            // registration link
            assertTrue(contentAsString(html).contains(Messages.get("index.text.registration") + "</a>"));
    });
}
 
开发者ID:peterszatmary,项目名称:learning-play-framework,代码行数:16,代码来源:IndexViewTest.java

示例4: renderTemplate

import play.twirl.api.Content; //导入依赖的package包/类
@Test
public void renderTemplate() {
    // If you are calling out to Assets, then you must instantiate an application
    // because it makes use of assets metadata that is configured from
    // the application.

    Content html = views.html.index.render("Your new application is ready.");
    assertThat("text/html").isEqualTo(html.contentType());
    assertThat(html.body()).contains("Your new application is ready.");
}
 
开发者ID:play2-maven-plugin,项目名称:play2-maven-test-projects,代码行数:11,代码来源:FunctionalTest.java

示例5: render

import play.twirl.api.Content; //导入依赖的package包/类
protected CompletionStage<Content> render(final PageData pageData, @Nullable final String templateName, @Nullable final String cmsKey) {
    if (cmsKey != null) {
        return cmsService.page(cmsKey, userLanguage.locales())
                .thenApplyAsync(cmsPage -> renderHtml(pageData, templateName, cmsPage.orElse(null)), HttpExecution.defaultContext());
    } else {
        return completedFuture(renderHtml(pageData, templateName, null));
    }
}
 
开发者ID:commercetools,项目名称:commercetools-sunrise-java,代码行数:9,代码来源:AbstractHtmlContentRenderer.java

示例6: renderLogin

import play.twirl.api.Content; //导入依赖的package包/类
@Test
public void renderLogin() {
	final Form<Login> loginForm = form (Login.class).fill (new Login (null));
    Content html = views.html.login.render(loginForm);
    assertThat(Helpers.contentType(html)).isEqualTo("text/html");
    assertThat(Helpers.contentAsString(html)).contains(Domain.message("web.application.title"));   
    assertThat(Helpers.contentAsString(html)).contains(Domain.message("web.application.login"));

}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:10,代码来源:ApplicationTest.java

示例7: render

import play.twirl.api.Content; //导入依赖的package包/类
protected Content render(String template, Parameters params) {
	Content content;
	try {
		content = call(templatePackageName + template, "render", params);
	} catch (ClassNotFoundException | MethodNotFoundException e) {
		if (log.isDebugEnabled())
			log.debug("template not found : '" + template + "'");
		return templateNotFound(template, params);
	}
	return content;
}
 
开发者ID:hakandilek,项目名称:play2-crud,代码行数:12,代码来源:TemplateController.java

示例8: templateNotFound

import play.twirl.api.Content; //导入依赖的package包/类
protected Content templateNotFound(String template, Parameters params) {
	StringBuilder sb = new StringBuilder("Template ");
	sb.append(templatePackageName).append(template).append("(");
	Class<?>[] types = params.types();
	for (int i = 0; i < types.length; i++) {
		Class<?> type = types[i];
		if (i != 0)
			sb.append(", ");
		sb.append(type.getSimpleName());
	}
	sb.append(") is not found");
	return Html.apply(sb.toString());
}
 
开发者ID:hakandilek,项目名称:play2-crud,代码行数:14,代码来源:TemplateController.java

示例9: render

import play.twirl.api.Content; //导入依赖的package包/类
@Override
protected Content render(String template, Parameters params) {
	Content content;
	try {
		content = call(templatePackageName + template, "render", params);
	} catch (ClassNotFoundException | MethodNotFoundException e) {
		if (log.isDebugEnabled())
			log.debug("template not found : '" + template + "'");
		throw new TemplateNotFoundException();
	}
	return content;
}
 
开发者ID:hakandilek,项目名称:play2-crud,代码行数:13,代码来源:DynamicCrudController.java

示例10: renderList

import play.twirl.api.Content; //导入依赖的package包/类
@Override
protected Content renderList(Page p) {
	try {
		return super.renderList(p);
	} catch (TemplateNotFoundException e) {
		// use dynamic template
		if (log.isDebugEnabled())
			log.debug("Rendering dynamic LIST template for model : " + model);
		return play.utils.crud.views.html.list.render(model, model.getFields().values(), p);
	}
}
 
开发者ID:hakandilek,项目名称:play2-crud,代码行数:12,代码来源:DynamicCrudController.java

示例11: renderForm

import play.twirl.api.Content; //导入依赖的package包/类
protected Content renderForm(Object key, Form form) {
	if (log.isDebugEnabled())
		log.debug("renderForm <- form:" + form);
	try {
		return super.renderForm(key, form);
	} catch (TemplateNotFoundException e) {
		// use dynamic template
		if (log.isDebugEnabled())
			log.debug("Rendering dynamic FORM template for model : " + model);
		return play.utils.crud.views.html.edit.render(model, model.getFields().values(), key, form);
	}
}
 
开发者ID:hakandilek,项目名称:play2-crud,代码行数:13,代码来源:DynamicCrudController.java

示例12: renderShow

import play.twirl.api.Content; //导入依赖的package包/类
@Override
protected Content renderShow(BasicModel modelObject) {
	try {
		return super.renderShow(modelObject);
	} catch (TemplateNotFoundException e) {
		// use dynamic template
		if (log.isDebugEnabled())
			log.debug("Rendering dynamic SHOW template for model : " + model);
		return play.utils.crud.views.html.show.render(model, model.getFields().values(), modelObject);
	}
}
 
开发者ID:hakandilek,项目名称:play2-crud,代码行数:12,代码来源:DynamicCrudController.java

示例13: renderTemplate

import play.twirl.api.Content; //导入依赖的package包/类
@Test
public void renderTemplate() {
    Content html = views.html.index.render("Your s3proxy application is ready.");
    assertThat(contentType(html)).isEqualTo("text/html");
    assertThat(contentAsString(html)).contains("Your s3proxy application is ready.");
}
 
开发者ID:webinerds,项目名称:s3-proxy-chunk-upload,代码行数:7,代码来源:ApplicationTest.java

示例14: renderTemplate

import play.twirl.api.Content; //导入依赖的package包/类
@Test
public void renderTemplate() {
    Content html = views.html.index.render("Your new application is ready.");
    assertEquals("text/html", html.contentType());
    assertTrue(html.body().contains("Your new application is ready."));
}
 
开发者ID:beingsagir,项目名称:play-java-spring-data-jpa,代码行数:7,代码来源:ApplicationTest.java

示例15: unauthorized

import play.twirl.api.Content; //导入依赖的package包/类
/** Diplay the normal login form if HTTP authentication fails */
@Override
protected Content unauthorized(Context context) {
	return login.render(this.auth, this.userProvider, this.LOGIN_FORM);
}
 
开发者ID:Vadus,项目名称:songs_play,代码行数:6,代码来源:MyStupidBasicAuthProvider.java


注:本文中的play.twirl.api.Content类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。