Search in sources :

Example 1 with ViewMessageBodyWriter

use of io.dropwizard.views.ViewMessageBodyWriter 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 ViewMessageBodyWriter

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

the class MustacheViewRendererTest method configure.

@Override
protected Application configure() {
    ResourceConfig config = DropwizardResourceConfig.forTesting();
    final ViewRenderer renderer = new MustacheViewRenderer();
    config.register(new ViewMessageBodyWriter(new MetricRegistry(), Collections.singletonList(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) DropwizardResourceConfig(io.dropwizard.jersey.DropwizardResourceConfig) ViewMessageBodyWriter(io.dropwizard.views.ViewMessageBodyWriter)

Example 3 with ViewMessageBodyWriter

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

the class FreemarkerViewRendererTest method configure.

@Override
protected Application configure() {
    ResourceConfig config = new ResourceConfig();
    final ViewRenderer renderer = new FreemarkerViewRenderer(Configuration.VERSION_2_3_30);
    config.register(new ViewMessageBodyWriter(new MetricRegistry(), Collections.singletonList(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 ViewMessageBodyWriter

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

the class MustacheViewRendererFileSystemTest method configure.

@Override
protected Application configure() {
    ResourceConfig config = DropwizardResourceConfig.forTesting();
    final ViewRenderer renderer = new MustacheViewRenderer();
    renderer.configure(Collections.singletonMap("fileRoot", "src/test/resources"));
    config.register(new ViewMessageBodyWriter(new MetricRegistry(), Collections.singletonList(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) DropwizardResourceConfig(io.dropwizard.jersey.DropwizardResourceConfig) 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 DropwizardResourceConfig (io.dropwizard.jersey.DropwizardResourceConfig)2