Search in sources :

Example 1 with ResteasyJackson2Provider

use of org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider in project syndesis-qe by syndesisio.

the class RestUtils method createJacksonProvider.

private static ResteasyJackson2Provider createJacksonProvider(Optional<SerializationFeature> serialization, Optional<DeserializationFeature> deserialization) {
    final ResteasyJackson2Provider jackson2Provider = new ResteasyJackson2Provider();
    final ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.registerModule(new Jdk8Module());
    if (serialization.isPresent()) {
        objectMapper.enable(serialization.get());
    }
    if (deserialization.isPresent()) {
        objectMapper.enable(deserialization.get());
    }
    jackson2Provider.setMapper(objectMapper);
    return jackson2Provider;
}
Also used : ResteasyJackson2Provider(org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider) Jdk8Module(com.fasterxml.jackson.datatype.jdk8.Jdk8Module) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Jdk8Module (com.fasterxml.jackson.datatype.jdk8.Jdk8Module)1 ResteasyJackson2Provider (org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider)1