本文整理汇总了Java中io.dropwizard.setup.Bootstrap.getObjectMapper方法的典型用法代码示例。如果您正苦于以下问题:Java Bootstrap.getObjectMapper方法的具体用法?Java Bootstrap.getObjectMapper怎么用?Java Bootstrap.getObjectMapper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.dropwizard.setup.Bootstrap
的用法示例。
在下文中一共展示了Bootstrap.getObjectMapper方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import io.dropwizard.setup.Bootstrap; //导入方法依赖的package包/类
@Override
public void initialize(Bootstrap<SECPConfiguration> bootstrap) {
bootstrap.addBundle(new AssetsBundle("/assets/app/", "/", "index.html"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/login", "index.html", "login"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/login/authenticate", "index.html", "authenticate"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/login/forgot-password", "index.html", "forgot-password"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/chats", "index.html", "chats"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal", "index.html", "portal"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/user-profile", "index.html", "user-profile"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/user-profile/change-password", "index.html", "change-password"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/group-profile", "index.html", "group-profile"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/audit", "index.html", "audit"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/audit/user", "index.html", "audit-user"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/audit/group", "index.html", "audit-group"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/manage", "index.html", "manage"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/manage/user", "index.html", "manage-user"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/manage/group", "index.html", "manage-group"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/configure", "index.html", "configure"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/configure/filter", "index.html", "tags"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/portal/configure/tags", "index.html", "filter"));
bootstrap.addBundle(new AssetsBundle("/assets/app", "/error/404", "index.html", "404"));
bootstrap.addBundle(hibernateBundle);
ObjectMapper mapper = bootstrap.getObjectMapper();
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
}
示例2: initialize
import io.dropwizard.setup.Bootstrap; //导入方法依赖的package包/类
@Override
public void initialize(Bootstrap<AppConfiguration> bootstrap) {
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor()
)
);
/* Configure objectMapper to instantiate immutable configuration correctly */
ObjectMapper objectMapper = bootstrap.getObjectMapper();
objectMapper.registerModule(new JSR310Module());
bootstrap.getObjectMapper()
.setVisibilityChecker(objectMapper.getSerializationConfig().getDefaultVisibilityChecker()
.withFieldVisibility(JsonAutoDetect.Visibility.ANY)
.withGetterVisibility(JsonAutoDetect.Visibility.NONE)
.withSetterVisibility(JsonAutoDetect.Visibility.NONE)
.withCreatorVisibility(JsonAutoDetect.Visibility.NONE));
/* Host static resources */
bootstrap.addBundle((new AssetsBundle("/assets", "/", "index.html", "static")));
/* Enable WebSockets support */
bootstrap.addBundle(websocketBundle = new WebsocketBundle<>());
}
示例3: run
import io.dropwizard.setup.Bootstrap; //导入方法依赖的package包/类
@Override
protected final void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws Exception {
final Environment environment = new Environment(bootstrap.getApplication().getName(),
bootstrap.getObjectMapper(),
bootstrap.getValidatorFactory().getValidator(),
bootstrap.getMetricRegistry(),
bootstrap.getClassLoader());
configuration.getMetricsFactory().configure(environment.lifecycle(),
bootstrap.getMetricRegistry());
bootstrap.run(configuration, environment);
href = namespace.getString("href");
try {
cleanupAsynchronously();
} catch (Exception e) {
cleanup();
throw e;
}
application.run(configuration, environment);
}
示例4: run
import io.dropwizard.setup.Bootstrap; //导入方法依赖的package包/类
@Override
public void run(final String... arguments) throws Exception {
final Bootstrap<AppConfiguration> bootstrap = new Bootstrap<>(this);
bootstrap.addCommand(command);
initialize(bootstrap);
ObjectMapper objectMapper = bootstrap.getObjectMapper();
bootstrap.getObjectMapper()
.setVisibilityChecker(objectMapper.getSerializationConfig().getDefaultVisibilityChecker()
.withFieldVisibility(JsonAutoDetect.Visibility.ANY)
.withGetterVisibility(JsonAutoDetect.Visibility.NONE)
.withSetterVisibility(JsonAutoDetect.Visibility.NONE)
.withCreatorVisibility(JsonAutoDetect.Visibility.NONE));
final Cli cli = new Cli(new JarLocation(getClass()), bootstrap, System.out, System.err);
if (!cli.run(arguments)) {
System.exit(1);
}
}
示例5: initialize
import io.dropwizard.setup.Bootstrap; //导入方法依赖的package包/类
@Override
public void initialize(Bootstrap<RestlerConfig> bootstrap) {
super.initialize(bootstrap);
ObjectMapper mapper = bootstrap.getObjectMapper();
mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
mapper.configure(DeserializationFeature.READ_ENUMS_USING_TO_STRING, true);
GuiceBundle<RestlerConfig> guiceBundle = GuiceBundle.defaultBuilder(RestlerConfig.class)
.modules(Lists.newArrayList(new RestlerServiceModule()))
.build();
bootstrap.addBundle(guiceBundle);
}
示例6: setup
import io.dropwizard.setup.Bootstrap; //导入方法依赖的package包/类
@Override
public void setup(Bootstrap<?> bootstrap) {
ObjectMapper om = bootstrap.getObjectMapper();
// for Config
om.addMixIn(SessionStore.class, sessionStoreMixin());
om.addMixIn(Authorizer.class, authorizerMixin());
om.addMixIn(HttpActionAdapter.class, httpActionAdapterMixin());
om.addMixIn(Matcher.class, matcherMixin());
om.addMixIn(SecurityLogic.class, securityLogicMixin());
om.addMixIn(CallbackLogic.class, callbackLogicMixin());
om.addMixIn(LogoutLogic.class, logoutLogicMixin());
// for Clients
om.addMixIn(Client.class, clientMixin());
om.addMixIn(BaseClient.class, baseClientMixin());
// for Clients and Client subsclasses
om.addMixIn(AjaxRequestResolver.class, ajaxRequestResolverMixin());
om.addMixIn(UrlResolver.class, urlResolverMixin());
om.addMixIn(AuthorizationGenerator.class,
authorizationGeneratorMixin());
// for Client/BaseClient
om.addMixIn(Authenticator.class, authenticatorMixin());
om.addMixIn(CredentialsExtractor.class, credentialExtractorMixin());
om.addMixIn(ProfileCreator.class, profileCreatorMixin());
// for IndirectClient
om.addMixIn(RedirectActionBuilder.class, redirectActionBuilderMixin());
om.addMixIn(LogoutActionBuilder.class, logoutActionBuilderMixin());
// for some of the Authenticators
om.addMixIn(PasswordEncoder.class, passwordEncoderMixin());
}
示例7: initialize
import io.dropwizard.setup.Bootstrap; //导入方法依赖的package包/类
@Override
public void initialize(Bootstrap<DropwizardServerConfiguration> bootstrap) {
ObjectMapper objectMapper = bootstrap.getObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}