Search in sources :

Example 1 with JacksonJaxbJsonProvider

use of org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider in project nifi-registry by apache.

the class JerseyNiFiRegistryClient method jacksonJaxbJsonProvider.

private static JacksonJaxbJsonProvider jacksonJaxbJsonProvider() {
    JacksonJaxbJsonProvider jacksonJaxbJsonProvider = new JacksonJaxbJsonProvider();
    ObjectMapper mapper = new ObjectMapper();
    mapper.setPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL));
    mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector(mapper.getTypeFactory()));
    // Ignore unknown properties so that deployed client remain compatible with future versions of NiFi Registry that add new fields
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    SimpleModule module = new SimpleModule();
    module.addDeserializer(BucketItem[].class, new BucketItemDeserializer());
    mapper.registerModule(module);
    jacksonJaxbJsonProvider.setMapper(mapper);
    return jacksonJaxbJsonProvider;
}
Also used : BucketItem(org.apache.nifi.registry.bucket.BucketItem) JacksonJaxbJsonProvider(org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JaxbAnnotationIntrospector(com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule)

Example 2 with JacksonJaxbJsonProvider

use of org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider in project nifi by apache.

the class JerseyNiFiClient method jacksonJaxbJsonProvider.

private static JacksonJaxbJsonProvider jacksonJaxbJsonProvider() {
    JacksonJaxbJsonProvider jacksonJaxbJsonProvider = new JacksonJaxbJsonProvider();
    ObjectMapper mapper = new ObjectMapper();
    mapper.setDefaultPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL));
    mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector(mapper.getTypeFactory()));
    // Ignore unknown properties so that deployed client remain compatible with future versions of NiFi that add new fields
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    jacksonJaxbJsonProvider.setMapper(mapper);
    return jacksonJaxbJsonProvider;
}
Also used : JacksonJaxbJsonProvider(org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JaxbAnnotationIntrospector(com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector)

Example 3 with JacksonJaxbJsonProvider

use of org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider in project nifi-registry by apache.

the class IntegrationTestBase method jacksonJaxbJsonProvider.

private static JacksonJaxbJsonProvider jacksonJaxbJsonProvider() {
    JacksonJaxbJsonProvider jacksonJaxbJsonProvider = new JacksonJaxbJsonProvider();
    ObjectMapper mapper = new ObjectMapper();
    mapper.setPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL));
    mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector(mapper.getTypeFactory()));
    // Ignore unknown properties so that deployed client remain compatible with future versions of NiFi Registry that add new fields
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    jacksonJaxbJsonProvider.setMapper(mapper);
    return jacksonJaxbJsonProvider;
}
Also used : JacksonJaxbJsonProvider(org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JaxbAnnotationIntrospector(com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 JaxbAnnotationIntrospector (com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector)3 JacksonJaxbJsonProvider (org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider)3 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)1 BucketItem (org.apache.nifi.registry.bucket.BucketItem)1