-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
76 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
core/src/main/java/io/sinistral/proteus/modules/JacksonModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package io.sinistral.proteus.modules; | ||
|
||
import com.fasterxml.jackson.databind.DeserializationFeature; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; | ||
import com.fasterxml.jackson.module.afterburner.AfterburnerModule; | ||
import com.google.inject.AbstractModule; | ||
import io.sinistral.proteus.server.Extractors; | ||
import io.sinistral.proteus.server.ServerResponse; | ||
|
||
public class JacksonModule extends AbstractModule | ||
{ | ||
@Override | ||
protected void configure() | ||
{ | ||
ObjectMapper objectMapper = new ObjectMapper(); | ||
|
||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | ||
objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT, true); | ||
objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true); | ||
objectMapper.configure(DeserializationFeature.EAGER_DESERIALIZER_FETCH, true); | ||
objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); | ||
objectMapper.configure(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, true); | ||
objectMapper.registerModule(new AfterburnerModule()); | ||
objectMapper.registerModule(new Jdk8Module()); | ||
|
||
this.bind(ObjectMapper.class).toInstance(objectMapper); | ||
|
||
this.requestStaticInjection(Extractors.class); | ||
this.requestStaticInjection(ServerResponse.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters