/* Ok, JSON/Smile support: need to register type handlers
* (partly to avoid having to annotate types)
*/
_jsonMapper = new ObjectMapper();
// with JSON, don't force numerics
_jsonMapper.registerModule(new ClusterMateTypesModule(false));
_jsonMapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);
SmileFactory sf = new SmileFactory();
// for our data, sharing names fine, shared values are 'meh', but enable
sf.enable(SmileGenerator.Feature.CHECK_SHARED_NAMES);
sf.enable(SmileGenerator.Feature.CHECK_SHARED_STRING_VALUES);
// and although we don't necessarily embed binary data, if we do, better be raw
sf.disable(SmileGenerator.Feature.ENCODE_BINARY_AS_7BIT);
// as to header, trailer: header, absolutely must write and require for reads;
// trailer: let's not; harmless but useless for our uses
sf.enable(SmileGenerator.Feature.WRITE_HEADER);
sf.disable(SmileGenerator.Feature.WRITE_END_MARKER);
sf.enable(SmileParser.Feature.REQUIRE_HEADER);
ObjectMapper smileMapper = new ObjectMapper(sf);
// with Smile, numerics make sense:
smileMapper.registerModule(new ClusterMateTypesModule(true));
// JAX-RS doesn't quite like if we try to close output...
smileMapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);
_smileMapper = smileMapper;
}