use of com.fasterxml.jackson.datatype.jdk8.StreamSerializer in project keycloak by keycloak.
the class ObjectMapperResolver method createStreamSerializer.
public static ObjectMapper createStreamSerializer() {
ObjectMapper mapper = new ObjectMapper();
JavaType type = TypeFactory.unknownType();
JavaType streamType = mapper.getTypeFactory().constructParametricType(Stream.class, type);
SimpleModule module = new SimpleModule();
module.addSerializer(new StreamSerializer(streamType, type));
mapper.registerModule(module);
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
if (Boolean.parseBoolean(System.getProperty("keycloak.jsonPrettyPrint", "false"))) {
mapper.enable(SerializationFeature.INDENT_OUTPUT);
}
return mapper;
}
Aggregations