Java 类io.dropwizard.views.ViewRenderer 实例源码

项目:sam    文件:Main.java   
@Override
public void initialize(Bootstrap<SamConfiguration> bootstrap) {

  final List<ViewRenderer> renderers = Arrays.asList(new MarkdownViewRenderer(), new HtmlViewRenderer(), new MustacheViewRenderer());
  bootstrap.addBundle(new ViewBundle<SamConfiguration>(renderers));
  bootstrap.addBundle(new AssetsBundle("/static", "/static", "index.mustache", "static"));
  bootstrap.addBundle(new AssetsBundle("/docs", "/docs", "index.html", "docs"));

  bootstrap.setConfigurationSourceProvider(
    new SubstitutingSourceProvider(
      bootstrap.getConfigurationSourceProvider(),
      new EnvironmentVariableSubstitutor()
    )
  );

  bootstrap.addCommand(new OAuth2Command());
  bootstrap.addCommand(new CreateDatabaseCommand(this));
  bootstrap.addCommand(new AddTestdataCommand(this));
}
项目:dropwizard-views-thymeleaf    文件:ExampleBootstrapAppication.java   
@Override
public void initialize(Bootstrap<ExampleBootstrapConfigration> bootstrap) {
      //
      bootstrap.addBundle(new AssetsBundle("/templates/css","/css",null,"css"));
      bootstrap.addBundle(new AssetsBundle("/templates/js","/js",null,"js"));
      bootstrap.addBundle(new AssetsBundle("/templates/fonts","/fonts",null,"fonts"));

    ImmutableSet<ViewRenderer> renderes= ImmutableSet.of((ViewRenderer)new ThymeleafViewRenderer());
    bootstrap.addBundle(new ViewBundle(renderes));

 }
项目:trimou    文件:TrimouViewRendererTest.java   
@Override
protected AppDescriptor configure() {
    final DefaultResourceConfig config = new DefaultResourceConfig();
    final ViewRenderer renderer = new TrimouViewRenderer.Builder().build();
    config.getSingletons().add(new ViewMessageBodyWriter(new MetricRegistry(), ImmutableList.of(renderer)));
    config.getSingletons().add(new TestResource());
    return new LowLevelAppDescriptor.Builder(config).build();
}
项目:dropwizard    文件:App.java   
@Override
public void initialize(Bootstrap<BookConfiguration> b) {
    b.addBundle(new ViewBundle(ImmutableList.<ViewRenderer>of(new FreemarkerViewRenderer())));
}
项目:dropwizard-views-thymeleaf    文件:ExampleApplication.java   
@Override
public void initialize(Bootstrap<ExampleConfiguration> bootstrap) {
    ImmutableSet<ViewRenderer> renderes= ImmutableSet.of((ViewRenderer)new ThymeleafViewRenderer());
    bootstrap.addBundle(new ViewBundle(renderes));

}