Search in sources :

Example 1 with AssetsBundle

use of io.dropwizard.assets.AssetsBundle in project microservices by pwillhan.

the class ServiceApplication method initializeViews.

private void initializeViews(final Bootstrap<ServiceConfiguration> bootstrap) {
    List<ViewRenderer> viewRenders = new ArrayList<>();
    viewRenders.add(new MustacheViewRenderer());
    bootstrap.addBundle(new ViewBundle<>(viewRenders));
    bootstrap.addBundle(new AssetsBundle("/assets", "/assets"));
}
Also used : MustacheViewRenderer(io.dropwizard.views.mustache.MustacheViewRenderer) ViewRenderer(io.dropwizard.views.ViewRenderer) MustacheViewRenderer(io.dropwizard.views.mustache.MustacheViewRenderer) ArrayList(java.util.ArrayList) SwaggerAssetsBundle(io.paradoxical.dropwizard.swagger.SwaggerAssetsBundle) AssetsBundle(io.dropwizard.assets.AssetsBundle)

Example 2 with AssetsBundle

use of io.dropwizard.assets.AssetsBundle in project Singularity by HubSpot.

the class SingularityService method initialize.

@Override
public void initialize(final Bootstrap<T> bootstrap) {
    if (!Strings.isNullOrEmpty(System.getProperty(SINGULARITY_DEFAULT_CONFIGURATION_PROPERTY))) {
        bootstrap.setConfigurationSourceProvider(new MergingSourceProvider(bootstrap.getConfigurationSourceProvider(), System.getProperty(SINGULARITY_DEFAULT_CONFIGURATION_PROPERTY), bootstrap.getObjectMapper(), new YAMLFactory()));
    }
    final Iterable<? extends Module> additionalModules = checkNotNull(getGuiceModules(bootstrap), "getGuiceModules() returned null");
    final Iterable<? extends Bundle> additionalBundles = checkNotNull(getDropwizardBundles(bootstrap), "getDropwizardBundles() returned null");
    final Iterable<? extends ConfiguredBundle<T>> additionalConfiguredBundles = checkNotNull(getDropwizardConfiguredBundles(bootstrap), "getDropwizardConfiguredBundles() returned null");
    guiceBundle = GuiceBundle.defaultBuilder(SingularityConfiguration.class).modules(new SingularityServiceModule()).modules(new SingularityAuthModule()).modules(additionalModules).build();
    bootstrap.addBundle(guiceBundle);
    bootstrap.addBundle(new CorsBundle());
    bootstrap.addBundle(new ViewBundle<>());
    bootstrap.addBundle(new AssetsBundle("/assets/static/", "/static/"));
    bootstrap.addBundle(new AssetsBundle("/assets/api-docs/", "/api-docs/", "index.html", "api-docs"));
    bootstrap.addBundle(new MigrationsBundle<SingularityConfiguration>() {

        @Override
        public DataSourceFactory getDataSourceFactory(final SingularityConfiguration configuration) {
            return configuration.getDatabaseConfiguration().get();
        }
    });
    for (Bundle bundle : additionalBundles) {
        bootstrap.addBundle(bundle);
    }
    for (ConfiguredBundle<T> configuredBundle : additionalConfiguredBundles) {
        bootstrap.addBundle(configuredBundle);
    }
    bootstrap.getObjectMapper().registerModule(new ProtobufModule());
    bootstrap.getObjectMapper().registerModule(new GuavaModule());
    bootstrap.getObjectMapper().setSerializationInclusion(Include.NON_NULL);
    bootstrap.getObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
Also used : DataSourceFactory(io.dropwizard.db.DataSourceFactory) CorsBundle(com.hubspot.singularity.bundles.CorsBundle) GuiceBundle(com.hubspot.dropwizard.guicier.GuiceBundle) MigrationsBundle(io.dropwizard.migrations.MigrationsBundle) ViewBundle(io.dropwizard.views.ViewBundle) AssetsBundle(io.dropwizard.assets.AssetsBundle) ConfiguredBundle(io.dropwizard.ConfiguredBundle) Bundle(io.dropwizard.Bundle) AssetsBundle(io.dropwizard.assets.AssetsBundle) GuavaModule(com.fasterxml.jackson.datatype.guava.GuavaModule) MergingSourceProvider(com.hubspot.singularity.config.MergingSourceProvider) CorsBundle(com.hubspot.singularity.bundles.CorsBundle) ProtobufModule(com.hubspot.jackson.datatype.protobuf.ProtobufModule) YAMLFactory(com.fasterxml.jackson.dataformat.yaml.YAMLFactory) SingularityConfiguration(com.hubspot.singularity.config.SingularityConfiguration)

Example 3 with AssetsBundle

use of io.dropwizard.assets.AssetsBundle in project timbuctoo by HuygensING.

the class TimbuctooV4 method initialize.

@Override
public void initialize(Bootstrap<TimbuctooConfiguration> bootstrap) {
    // bundles
    activeMqBundle = new ActiveMQBundle();
    bootstrap.addBundle(activeMqBundle);
    bootstrap.addBundle(new MultiPartBundle());
    bootstrap.addBundle(new AssetsBundle("/static", "/static", "index.html"));
    /*
     * Make it possible to use environment variables in the config.
     * see: http://www.dropwizard.io/0.9.1/docs/manual/core.html#environment-variables
     */
    bootstrap.setConfigurationSourceProvider(new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(true)));
}
Also used : SubstitutingSourceProvider(io.dropwizard.configuration.SubstitutingSourceProvider) MultiPartBundle(io.dropwizard.forms.MultiPartBundle) ActiveMQBundle(com.kjetland.dropwizard.activemq.ActiveMQBundle) EnvironmentVariableSubstitutor(io.dropwizard.configuration.EnvironmentVariableSubstitutor) AssetsBundle(io.dropwizard.assets.AssetsBundle)

Example 4 with AssetsBundle

use of io.dropwizard.assets.AssetsBundle in project streamline by hortonworks.

the class StreamlineApplication method initialize.

@Override
public void initialize(Bootstrap<StreamlineConfiguration> bootstrap) {
    bootstrap.addBundle(new AssetsBundle("/assets", "/", "index.html", "static"));
    super.initialize(bootstrap);
}
Also used : AssetsBundle(io.dropwizard.assets.AssetsBundle)

Example 5 with AssetsBundle

use of io.dropwizard.assets.AssetsBundle in project registry by hortonworks.

the class RegistryApplication method initialize.

@Override
public void initialize(Bootstrap<RegistryConfiguration> bootstrap) {
    // always deploy UI on /ui. If there is no other filter like Confluent etc, redirect / to /ui
    bootstrap.addBundle(new AssetsBundle("/assets", "/ui", "index.html", "static"));
    bootstrap.addBundle(new SwaggerBundle<RegistryConfiguration>() {

        @Override
        protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(RegistryConfiguration registryConfiguration) {
            return registryConfiguration.getSwaggerBundleConfiguration();
        }
    });
    super.initialize(bootstrap);
}
Also used : AssetsBundle(io.dropwizard.assets.AssetsBundle) SwaggerBundleConfiguration(io.federecio.dropwizard.swagger.SwaggerBundleConfiguration)

Aggregations

AssetsBundle (io.dropwizard.assets.AssetsBundle)11 EnvironmentVariableSubstitutor (io.dropwizard.configuration.EnvironmentVariableSubstitutor)2 SubstitutingSourceProvider (io.dropwizard.configuration.SubstitutingSourceProvider)2 DataSourceFactory (io.dropwizard.db.DataSourceFactory)2 MultiPartBundle (io.dropwizard.forms.MultiPartBundle)2 ViewBundle (io.dropwizard.views.ViewBundle)2 Map (java.util.Map)2 RenderCommand (com.example.helloworld.cli.RenderCommand)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 YAMLFactory (com.fasterxml.jackson.dataformat.yaml.YAMLFactory)1 GuavaModule (com.fasterxml.jackson.datatype.guava.GuavaModule)1 ImportCommand (com.graphhopper.application.cli.ImportCommand)1 MatchCommand (com.graphhopper.application.cli.MatchCommand)1 GraphHopperBundle (com.graphhopper.http.GraphHopperBundle)1 RealtimeBundle (com.graphhopper.http.RealtimeBundle)1 GuiceBundle (com.hubspot.dropwizard.guicier.GuiceBundle)1 ProtobufModule (com.hubspot.jackson.datatype.protobuf.ProtobufModule)1 CorsBundle (com.hubspot.singularity.bundles.CorsBundle)1 MergingSourceProvider (com.hubspot.singularity.config.MergingSourceProvider)1 SingularityConfiguration (com.hubspot.singularity.config.SingularityConfiguration)1