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


Java Content类代码示例

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


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

示例1: getResult

import play.mvc.Content; //导入依赖的package包/类
/**
 * getResult
 * @return response's body as a play framework Result
 * @throws Exception
 */
@JsonIgnore
public Result getResult () throws Exception {
  
  if (this.getType() == ResponseType.JSON) {
  
    return Results.ok((String)this.getContent() );
  } else if (this.getType() == ResponseType.FILE) {
  
    return Results.ok(new FileInputStream((String)this.getContent() ) );
  } else if (this.getType() == ResponseType.HTML) {
    
    return Results.ok((Content)this.getContent() );
  }
  
  throw new CodeException(
    151,
    12,
    "Unhandled ResponseBody Type ["
    + this.getType().toString()
    + "]",
    ExceptionClass.TYPE);
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:28,代码来源:ResponseBody.java

示例2: renderTemplate

import play.mvc.Content; //导入依赖的package包/类
/**
 * Illustrates how to render a template for testing.
 */
@Test
public void renderTemplate() {
  Content html = views.html.index.render("Welcome to the home page.");
  assertThat(contentType(html)).isEqualTo("text/html");
  assertThat(contentAsString(html)).contains("home page");
}
 
开发者ID:jamestvu,项目名称:PlayResponsiveKamanu-1,代码行数:10,代码来源:ApplicationTest.java

示例3: renderTemplate

import play.mvc.Content; //导入依赖的package包/类
@Test
public void renderTemplate() {
    Content html = views.html.index.render(Collections.<Resource>emptyList(),
            Form.form(Resource.class));
    assertThat(contentType(html)).isEqualTo("text/html");
    assertThat(contentAsString(html)).contains(Messages.get("header"));
}
 
开发者ID:Sonat-Consulting,项目名称:javabin-play-public,代码行数:8,代码来源:ApplicationTest.java

示例4: renderTemplate

import play.mvc.Content; //导入依赖的package包/类
/**
 * Illustrates how to render a template for testing.
 */
@Test
public void renderTemplate() {
  Content html = views.html.Index.render("Welcome to the home page.");
  assertThat(contentType(html)).isEqualTo("text/html");
  assertThat(contentAsString(html)).contains("home page");
}
 
开发者ID:sanpeim,项目名称:PlayResponsiveKamanu,代码行数:10,代码来源:ApplicationTest.java

示例5: renderTemplate

import play.mvc.Content; //导入依赖的package包/类
@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.");
}
 
开发者ID:fmaturel,项目名称:PlayTraining,代码行数:7,代码来源:ApplicationTest.java

示例6: renderIndex

import play.mvc.Content; //导入依赖的package包/类
@Test
public void renderIndex() {
    Content html = views.html.index.render(Observation.all(),Country.all(),Indicator.all());
    assertThat(contentType(html)).isEqualTo("text/html");
    assertThat(contentAsString(html)).contains("ObservaTerra"); 
}
 
开发者ID:Arquisoft,项目名称:ObservaTerra42,代码行数:7,代码来源:ApplicationTest.java

示例7: renderIndex

import play.mvc.Content; //导入依赖的package包/类
@Test
public void renderIndex() {
    Content html = views.html.index2.render();
    assertThat(contentType(html)).isEqualTo("text/html");
    assertThat(contentAsString(html)).contains("ObservaTerra"); 
}
 
开发者ID:Arquisoft,项目名称:ObservaTerra51,代码行数:7,代码来源:ApplicationTest.java

示例8: renderLogin

import play.mvc.Content; //导入依赖的package包/类
@Test
public void renderLogin() {
    Content html = views.html.index2.render();
    assertThat(contentType(html)).isEqualTo("text/html");
    assertThat(contentAsString(html)).contains("ObservaTerra");
}
 
开发者ID:Arquisoft,项目名称:ObservaTerra51,代码行数:7,代码来源:ApplicationTest.java

示例9: renderObservationsList

import play.mvc.Content; //导入依赖的package包/类
@Test
public void renderObservationsList() {
    Content html = views.html.login.loginform.render(loginForm);
    assertThat(contentType(html)).isEqualTo("text/html");
    assertThat(contentAsString(html)).contains("ObservaTerra");
}
 
开发者ID:Arquisoft,项目名称:ObservaTerra51,代码行数:7,代码来源:ApplicationTest.java

示例10: renderProfile

import play.mvc.Content; //导入依赖的package包/类
@Test
public void renderProfile() {
    Content html = views.html.profile.render("admin");//Just a test, you should be logged in...
    assertThat(contentType(html)).isEqualTo("text/html");
    assertThat(contentAsString(html)).contains("div");
}
 
开发者ID:Arquisoft,项目名称:ObservaTerra51,代码行数:7,代码来源:ApplicationTest.java

示例11: renderSignUp

import play.mvc.Content; //导入依赖的package包/类
@Test
public void renderSignUp() {
    Content html = views.html.signup.form.render(signupForm);
    assertThat(contentType(html)).isEqualTo("text/html");
    assertThat(contentAsString(html)).contains("Sign");
}
 
开发者ID:Arquisoft,项目名称:ObservaTerra51,代码行数:7,代码来源:ApplicationTest.java

示例12: renderSummary

import play.mvc.Content; //导入依赖的package包/类
@Test
public void renderSummary(){
    Content html = views.html.signup.summary.render(new User());//empty user => empty summary, but it renders...
    assertThat(contentType(html)).isEqualTo("text/html");
    assertThat(contentAsString(html)).contains("ObservaTerra");
}
 
开发者ID:Arquisoft,项目名称:ObservaTerra51,代码行数:7,代码来源:ApplicationTest.java

示例13: renderTemplate

import play.mvc.Content; //导入依赖的package包/类
@Test
public void renderTemplate() {
    Content html = views.html.index.render(Messages.get("application.name"));
    assertThat(contentType(html)).isEqualTo("text/html");
    assertThat(contentAsString(html)).contains(Messages.get("application.name"));
}
 
开发者ID:morteza,项目名称:tracker,代码行数:7,代码来源:ApplicationTest.java

示例14: setHtmlContent

import play.mvc.Content; //导入依赖的package包/类
/**
 * setHtmlContent
 * alternative to overriding the method below
 *   setHtmlContent (Object... args)
 *   this method can be directly called instead
 * @param htmlContent
 * @throws Exception
 */
@JsonIgnore
final public void setHtmlContent (Content htmlContent) throws Exception {
  
  this.content = htmlContent;
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:14,代码来源:ResponseBodyHtml.java


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