Search in sources :

Example 6 with AssetsBundle

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

the class HelloWorldApplication method initialize.

@Override
public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap) {
    // Enable variable substitution with environment variables
    bootstrap.setConfigurationSourceProvider(new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false)));
    bootstrap.addCommand(new RenderCommand());
    bootstrap.addBundle(new AssetsBundle());
    bootstrap.addBundle(new MigrationsBundle<HelloWorldConfiguration>() {

        @Override
        public DataSourceFactory getDataSourceFactory(HelloWorldConfiguration configuration) {
            return configuration.getDataSourceFactory();
        }
    });
    bootstrap.addBundle(hibernateBundle);
    bootstrap.addBundle(new ViewBundle<HelloWorldConfiguration>() {

        @Override
        public Map<String, Map<String, String>> getViewConfiguration(HelloWorldConfiguration configuration) {
            return configuration.getViewRendererConfiguration();
        }
    });
}
Also used : SubstitutingSourceProvider(io.dropwizard.configuration.SubstitutingSourceProvider) RenderCommand(com.example.helloworld.cli.RenderCommand) DataSourceFactory(io.dropwizard.db.DataSourceFactory) EnvironmentVariableSubstitutor(io.dropwizard.configuration.EnvironmentVariableSubstitutor) AssetsBundle(io.dropwizard.assets.AssetsBundle) Map(java.util.Map)

Example 7 with AssetsBundle

use of io.dropwizard.assets.AssetsBundle in project graphhopper by graphhopper.

the class GraphHopperApplication method initialize.

@Override
public void initialize(Bootstrap<GraphHopperServerConfiguration> bootstrap) {
    bootstrap.addBundle(new GraphHopperBundle());
    bootstrap.addBundle(new RealtimeBundle());
    bootstrap.addCommand(new ImportCommand());
    bootstrap.addCommand(new MatchCommand());
    bootstrap.addBundle(new AssetsBundle("/com/graphhopper/maps/", "/maps/", "index.html"));
    // see this link even though its outdated?! // https://www.webjars.org/documentation#dropwizard
    bootstrap.addBundle(new AssetsBundle("/META-INF/resources/webjars", "/webjars/", null, "webjars"));
}
Also used : ImportCommand(com.graphhopper.application.cli.ImportCommand) RealtimeBundle(com.graphhopper.http.RealtimeBundle) AssetsBundle(io.dropwizard.assets.AssetsBundle) MatchCommand(com.graphhopper.application.cli.MatchCommand) GraphHopperBundle(com.graphhopper.http.GraphHopperBundle)

Example 8 with AssetsBundle

use of io.dropwizard.assets.AssetsBundle in project pinot by linkedin.

the class ThirdEyeDashboardApplication method initialize.

@Override
public void initialize(Bootstrap<ThirdEyeDashboardConfiguration> bootstrap) {
    bootstrap.addBundle(new ViewBundle());
    bootstrap.addBundle(new HelperBundle());
    bootstrap.addBundle(new AssetsBundle("/assets", "/assets"));
    bootstrap.addBundle(new AssetsBundle("/assets/css", "/assets/css", null, "css"));
    bootstrap.addBundle(new AssetsBundle("/assets/js", "/assets/js", null, "js"));
    bootstrap.addBundle(new AssetsBundle("/assets/lib", "/assets/lib", null, "lib"));
    bootstrap.addBundle(new AssetsBundle("/assets/img", "/assets/img", null, "img"));
    bootstrap.addBundle(new AssetsBundle("/assets/data", "/assets/data", null, "data"));
}
Also used : AssetsBundle(io.dropwizard.assets.AssetsBundle) ViewBundle(io.dropwizard.views.ViewBundle)

Example 9 with AssetsBundle

use of io.dropwizard.assets.AssetsBundle in project api-core by ca-cwds.

the class BaseApiApplication method configureSwagger.

private void configureSwagger(final T apiConfiguration, final Environment environment) {
    BeanConfig config = new BeanConfig();
    SwaggerConfiguration swaggerConfiguration = apiConfiguration.getSwaggerConfiguration();
    config.setTitle(swaggerConfiguration.getTitle());
    config.setDescription(swaggerConfiguration.getDescription());
    config.setResourcePackage(swaggerConfiguration.getResourcePackage());
    config.setScan(true);
    new AssetsBundle(swaggerConfiguration.getAssetsPath(), swaggerConfiguration.getAssetsPath(), null, "swagger").run(environment);
    LOGGER.info("Registering ApiListingResource");
    environment.jersey().register(new ApiListingResource());
    LOGGER.info("Registering SwaggerResource");
    SwaggerResource swaggerResource = new SwaggerResource(swaggerConfiguration);
    environment.jersey().register(swaggerResource);
    if (swaggerConfiguration.isShowSwagger()) {
        TokenResource tokenResource = new TokenResource(swaggerConfiguration);
        environment.jersey().register(tokenResource);
    }
}
Also used : BeanConfig(io.swagger.jaxrs.config.BeanConfig) SwaggerResource(gov.ca.cwds.rest.resources.SwaggerResource) TokenResource(gov.ca.cwds.rest.resources.TokenResource) AssetsBundle(io.dropwizard.assets.AssetsBundle) ApiListingResource(io.swagger.jaxrs.listing.ApiListingResource)

Example 10 with AssetsBundle

use of io.dropwizard.assets.AssetsBundle in project newts by OpenNMS.

the class NewtsService method initialize.

@Override
public void initialize(Bootstrap<NewtsConfig> bootstrap) {
    bootstrap.addCommand(new InitCommand());
    bootstrap.addBundle(new AssetsBundle("/app", UI_URL_PATH, "index.html"));
}
Also used : AssetsBundle(io.dropwizard.assets.AssetsBundle)

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