Search in sources :

Example 1 with ViewRenderer

use of io.dropwizard.views.ViewRenderer in project dropwizard by dropwizard.

the class MultipleContentTypeTest method configure.

@Override
protected Application configure() {
    forceSet(TestProperties.CONTAINER_PORT, "0");
    final ViewRenderer renderer = new FreemarkerViewRenderer();
    return DropwizardResourceConfig.forTesting(new MetricRegistry()).register(new ViewMessageBodyWriter(new MetricRegistry(), ImmutableList.of(renderer))).register(new InfoMessageBodyWriter()).register(new ExampleResource());
}
Also used : ViewRenderer(io.dropwizard.views.ViewRenderer) MetricRegistry(com.codahale.metrics.MetricRegistry) ViewMessageBodyWriter(io.dropwizard.views.ViewMessageBodyWriter)

Example 2 with ViewRenderer

use of io.dropwizard.views.ViewRenderer in project dropwizard by dropwizard.

the class MustacheViewRendererTest method configure.

@Override
protected Application configure() {
    forceSet(TestProperties.CONTAINER_PORT, "0");
    ResourceConfig config = new ResourceConfig();
    final ViewRenderer renderer = new MustacheViewRenderer();
    config.register(new ViewMessageBodyWriter(new MetricRegistry(), ImmutableList.of(renderer)));
    config.register(new ViewRenderExceptionMapper());
    config.register(new ExampleResource());
    return config;
}
Also used : ViewRenderExceptionMapper(io.dropwizard.views.ViewRenderExceptionMapper) ViewRenderer(io.dropwizard.views.ViewRenderer) MetricRegistry(com.codahale.metrics.MetricRegistry) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) ViewMessageBodyWriter(io.dropwizard.views.ViewMessageBodyWriter)

Example 3 with ViewRenderer

use of io.dropwizard.views.ViewRenderer in project dropwizard by dropwizard.

the class FreemarkerViewRendererTest method configure.

@Override
protected Application configure() {
    ResourceConfig config = new ResourceConfig();
    final ViewRenderer renderer = new FreemarkerViewRenderer();
    config.register(new ViewMessageBodyWriter(new MetricRegistry(), ImmutableList.of(renderer)));
    config.register(new ExampleResource());
    config.register(new ViewRenderExceptionMapper());
    return config;
}
Also used : ViewRenderExceptionMapper(io.dropwizard.views.ViewRenderExceptionMapper) ViewRenderer(io.dropwizard.views.ViewRenderer) MetricRegistry(com.codahale.metrics.MetricRegistry) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) ViewMessageBodyWriter(io.dropwizard.views.ViewMessageBodyWriter)

Example 4 with ViewRenderer

use of io.dropwizard.views.ViewRenderer in project dropwizard by dropwizard.

the class MustacheViewRendererFileSystemTest method configure.

@Override
protected Application configure() {
    forceSet(TestProperties.CONTAINER_PORT, "0");
    ResourceConfig config = new ResourceConfig();
    final ViewRenderer renderer = new MustacheViewRenderer();
    renderer.configure(ImmutableMap.of("fileRoot", "src/test/resources"));
    config.register(new ViewMessageBodyWriter(new MetricRegistry(), ImmutableList.of(renderer)));
    config.register(new ViewRenderExceptionMapper());
    config.register(new ExampleResource());
    return config;
}
Also used : ViewRenderExceptionMapper(io.dropwizard.views.ViewRenderExceptionMapper) ViewRenderer(io.dropwizard.views.ViewRenderer) MetricRegistry(com.codahale.metrics.MetricRegistry) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) ViewMessageBodyWriter(io.dropwizard.views.ViewMessageBodyWriter)

Aggregations

MetricRegistry (com.codahale.metrics.MetricRegistry)4 ViewMessageBodyWriter (io.dropwizard.views.ViewMessageBodyWriter)4 ViewRenderer (io.dropwizard.views.ViewRenderer)4 ViewRenderExceptionMapper (io.dropwizard.views.ViewRenderExceptionMapper)3 ResourceConfig (org.glassfish.jersey.server.ResourceConfig)3