protected EndpointConfig initWriter(ObjectMapper mapper) { // first common config if (_activeView != null) { _writer = mapper.writerWithView(_activeView); } else { _writer = mapper.writer(); } if (_rootName != null) { _writer = _writer.withRootName(_rootName); } // Then features if (_serEnable != null) { _writer = _writer.withFeatures(_serEnable); } if (_serDisable != null) { _writer = _writer.withoutFeatures(_serDisable); } // then others // Finally: couple of features we always set /* Important: we are NOT to close the underlying stream after * mapping, so we need to instruct parser: */ _writer.getJsonFactory().disable(JsonGenerator.Feature.AUTO_CLOSE_TARGET); return this; }