Search in sources :

Example 1 with MultiPartBundle

use of io.dropwizard.forms.MultiPartBundle 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 2 with MultiPartBundle

use of io.dropwizard.forms.MultiPartBundle in project irontest by zheng-wang.

the class IronTestApplication method initialize.

@Override
public void initialize(Bootstrap<IronTestConfiguration> bootstrap) {
    bootstrap.addBundle(new AssetsBundle("/assets/app", "/ui", "index.htm", "ui"));
    bootstrap.addBundle(new AssetsBundle("/META-INF/resources/webjars", "/ui/lib", null, "lib"));
    bootstrap.addBundle(new AssetsBundle("/assets/mockserver", "/ui/mockserver", "mockserver.htm", "mockserver"));
    bootstrap.addBundle(new AssetsBundle("/assets/common", "/ui/common", null, "common"));
    bootstrap.addBundle(jaxWsBundle);
    bootstrap.addBundle(new MultiPartBundle());
    bootstrap.addBundle(new ViewBundle<IronTestConfiguration>() {

        @Override
        public Map<String, Map<String, String>> getViewConfiguration(IronTestConfiguration config) {
            return config.getViewRendererConfiguration();
        }
    });
    Configuration.setDefaults(new Configuration.Defaults() {

        private final JsonProvider jsonProvider = new JacksonJsonProvider();

        private final MappingProvider mappingProvider = new JacksonMappingProvider();

        @Override
        public JsonProvider jsonProvider() {
            return jsonProvider;
        }

        @Override
        public MappingProvider mappingProvider() {
            return mappingProvider;
        }

        @Override
        public Set<Option> options() {
            return EnumSet.noneOf(Option.class);
        }
    });
    // configure the Jackson ObjectMapper used by JAX-RS (Jersey)
    ObjectMapper objectMapper = bootstrap.getObjectMapper();
    objectMapper.disable(MapperFeature.DEFAULT_VIEW_INCLUSION);
    IronTestUtils.addMixInsForWireMock(objectMapper);
}
Also used : MultiPartBundle(io.dropwizard.forms.MultiPartBundle) EnumSet(java.util.EnumSet) Set(java.util.Set) Configuration(com.jayway.jsonpath.Configuration) JacksonJsonProvider(com.jayway.jsonpath.spi.json.JacksonJsonProvider) AssetsBundle(io.dropwizard.assets.AssetsBundle) JacksonMappingProvider(com.jayway.jsonpath.spi.mapper.JacksonMappingProvider) MappingProvider(com.jayway.jsonpath.spi.mapper.MappingProvider) JsonProvider(com.jayway.jsonpath.spi.json.JsonProvider) JacksonJsonProvider(com.jayway.jsonpath.spi.json.JacksonJsonProvider) JacksonMappingProvider(com.jayway.jsonpath.spi.mapper.JacksonMappingProvider) Option(com.jayway.jsonpath.Option) Map(java.util.Map) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

AssetsBundle (io.dropwizard.assets.AssetsBundle)2 MultiPartBundle (io.dropwizard.forms.MultiPartBundle)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Configuration (com.jayway.jsonpath.Configuration)1 Option (com.jayway.jsonpath.Option)1 JacksonJsonProvider (com.jayway.jsonpath.spi.json.JacksonJsonProvider)1 JsonProvider (com.jayway.jsonpath.spi.json.JsonProvider)1 JacksonMappingProvider (com.jayway.jsonpath.spi.mapper.JacksonMappingProvider)1 MappingProvider (com.jayway.jsonpath.spi.mapper.MappingProvider)1 ActiveMQBundle (com.kjetland.dropwizard.activemq.ActiveMQBundle)1 EnvironmentVariableSubstitutor (io.dropwizard.configuration.EnvironmentVariableSubstitutor)1 SubstitutingSourceProvider (io.dropwizard.configuration.SubstitutingSourceProvider)1 EnumSet (java.util.EnumSet)1 Map (java.util.Map)1 Set (java.util.Set)1