tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwaastad <he...@waastad.org>
Subject Re: serializeAsArray JacksonJaxbJsonProvider
Date Mon, 20 Oct 2014 16:15:06 GMT
Hi,
typical example:

@Provider
public class CustomJacksonJaxBJsonProvider extends JacksonJaxbJsonProvider {

    private static ObjectMapper commonMapper = null;

    public CustomJacksonJaxBJsonProvider() {
        if (commonMapper == null) {
            ObjectMapper mapper = new ObjectMapper();

            mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);

            mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS,
false);
            mapper.configure(SerializationFeature.INDENT_OUTPUT, false);
            mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);

           
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
            mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE,
false);

            mapper.registerModule(new JaxbAnnotationModule());

            commonMapper = mapper;
        }
        super.setMapper(commonMapper);
    }
}

br hw



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/serializeAsArray-JacksonJaxbJsonProvider-tp4672427p4672498.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Mime
View raw message