Search in sources :

Example 1 with FreemarkerViewRenderer

use of io.dropwizard.views.freemarker.FreemarkerViewRenderer in project fallout by datastax.

the class FalloutServiceBase method initialize.

@Override
public void initialize(Bootstrap<FC> bootstrap) {
    bootstrap.addBundle(new ViewBundle<FC>(Set.of(new MustacheViewRendererWithoutTemplatingErrors(), // SwaggerBundle uses Freemarker templates
    new FreemarkerViewRenderer())) {

        @Override
        public Map<String, Map<String, String>> getViewConfiguration(FC configuration) {
            return Boolean.getBoolean("fallout.devmode") ? Map.of("mustache", Map.of("cache", "false", "fileRoot", "src/main/resources")) : Map.of();
        }
    });
    bootstrap.addBundle(new AssetsBundle("/assets", ASSETS_ROOT_PATH));
    bootstrap.addCommand(new FalloutExecCommand<>(this));
    bootstrap.addCommand(new FalloutValidateCommand<>(this));
    bootstrap.addCommand(new FalloutStandaloneCommand<>(this));
    bootstrap.addCommand(new FalloutRunnerCommand<>(this));
    bootstrap.addCommand(new FalloutQueueCommand<>(this));
    bootstrap.addCommand(new CheckCommand<>(this));
    bootstrap.addCommand(new GenerateNginxConf<>(this));
    bootstrap.addCommand(new Cassandra<>(this));
    bootstrap.addBundle(new SwaggerBundle<>() {

        @Override
        protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(FC configuration) {
            SwaggerBundleConfiguration swaggerBundleConfiguration = new SwaggerBundleConfiguration();
            swaggerBundleConfiguration.setResourcePackage("com.datastax.fallout.service.resources." + (configuration.getMode() == ServerMode.RUNNER ? "runner" : "server"));
            if (configuration.getExternalUrl() != null) {
                swaggerBundleConfiguration.setSchemes(new String[] { URI.create(configuration.getExternalUrl()).getScheme() });
            }
            return swaggerBundleConfiguration;
        }
    });
    bootstrap.setObjectMapper(JacksonUtils.getObjectMapper());
}
Also used : MustacheViewRendererWithoutTemplatingErrors(com.datastax.fallout.util.MustacheViewRendererWithoutTemplatingErrors) AssetsBundle(io.dropwizard.assets.AssetsBundle) SwaggerBundleConfiguration(io.federecio.dropwizard.swagger.SwaggerBundleConfiguration) FreemarkerViewRenderer(io.dropwizard.views.freemarker.FreemarkerViewRenderer) Map(java.util.Map)

Example 2 with FreemarkerViewRenderer

use of io.dropwizard.views.freemarker.FreemarkerViewRenderer in project conquery by bakdata.

the class Freemarker method rendererForHtml.

private static FreemarkerViewRenderer rendererForHtml() {
    FreemarkerViewRenderer freemarker = new FreemarkerViewRenderer(VERSION);
    freemarker.configure(Freemarker.asMap());
    return freemarker;
}
Also used : FreemarkerViewRenderer(io.dropwizard.views.freemarker.FreemarkerViewRenderer)

Aggregations

FreemarkerViewRenderer (io.dropwizard.views.freemarker.FreemarkerViewRenderer)2 MustacheViewRendererWithoutTemplatingErrors (com.datastax.fallout.util.MustacheViewRendererWithoutTemplatingErrors)1 AssetsBundle (io.dropwizard.assets.AssetsBundle)1 SwaggerBundleConfiguration (io.federecio.dropwizard.swagger.SwaggerBundleConfiguration)1 Map (java.util.Map)1