예제 #1
0
 @Override
 public void afterPropertiesSet() throws Exception {
   jsonProvider.setMapper(jacksonMapper);
   jacksonMapper.setSerializerFactory(serializerFactory);
   jacksonMapper.setSerializationInclusion(Inclusion.NON_NULL);
   serializerFactory.addSpecificMapping(BigInteger.class, this);
 }
  @Override
  public void writeTo(
      Object value,
      Class<?> type,
      Type genericType,
      Annotation[] annotations,
      MediaType mediaType,
      MultivaluedMap<String, Object> httpHeaders,
      OutputStream entityStream)
      throws IOException {
    ObjectMapper objectMapper = locateMapper(type, mediaType);
    objectMapper.setSerializationInclusion(Inclusion.NON_NULL);

    super.writeTo(value, type, genericType, annotations, mediaType, httpHeaders, entityStream);
  }
예제 #3
0
  @Override
  public void writeTo(
      Object value,
      Class<?> type,
      Type genericType,
      Annotation[] annotations,
      MediaType mediaType,
      MultivaluedMap<String, Object> httpHeaders,
      OutputStream entityStream)
      throws IOException {
    ObjectMapper mapper = locateMapper(type, mediaType);

    SerializationConfig newSerializerConfig =
        mapper
            .getSerializationConfig()
            .without(Feature.FAIL_ON_EMPTY_BEANS)
            .without(Feature.WRITE_DATES_AS_TIMESTAMPS);

    mapper.setSerializationConfig(newSerializerConfig);
    mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);

    super.writeTo(value, type, genericType, annotations, mediaType, httpHeaders, entityStream);
  }