Package org.sdase.commons.server.jackson
Class JacksonConfigurationBundle
- java.lang.Object
-
- org.sdase.commons.server.jackson.JacksonConfigurationBundle
-
- All Implemented Interfaces:
io.dropwizard.ConfiguredBundle<io.dropwizard.Configuration>
public class JacksonConfigurationBundle extends java.lang.Object implements io.dropwizard.ConfiguredBundle<io.dropwizard.Configuration>
Configures theObjectMapper
to support HAL structures usingResource
,Link
andEmbeddedResource
and field filtering on client request for resources annotated byEnableFieldFilter
.The module registers itself when created in the
run method
of the application:public void run(SolutionServiceConfiguration configuration, Environment environment) { // ... JacksonConfigurationBundle.builder(environment).build(); // ... }
If Jacksons yaml provider is available in the classpath it will be registered as well so that the application is able to respond to "Accept application/yaml" requests. The JacksonYAMLProvider is available with
com.fasterxml.jackson.jaxrs:jackson-jaxrs-yaml-provider:[jacksonVersion]
. The class will be loaded dynamically to avoid a forced runtime dependency.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JacksonConfigurationBundle.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JacksonConfigurationBundle.Builder
builder()
void
initialize(io.dropwizard.setup.Bootstrap<?> bootstrap)
Initializes theObjectMapper
as in the defaultBootstrap
but does not add theFuzzyEnumModule
as it breaks enum features of Jackson.void
run(io.dropwizard.Configuration configuration, io.dropwizard.setup.Environment environment)
-
-
-
Method Detail
-
builder
public static JacksonConfigurationBundle.Builder builder()
-
initialize
public void initialize(io.dropwizard.setup.Bootstrap<?> bootstrap)
Initializes theObjectMapper
as in the defaultBootstrap
but does not add theFuzzyEnumModule
as it breaks enum features of Jackson.- Specified by:
initialize
in interfaceio.dropwizard.ConfiguredBundle<io.dropwizard.Configuration>
-
run
public void run(io.dropwizard.Configuration configuration, io.dropwizard.setup.Environment environment)
- Specified by:
run
in interfaceio.dropwizard.ConfiguredBundle<io.dropwizard.Configuration>
-
-