Search in sources :

Example 1 with Jackson2ObjectMapperFactoryBean

use of org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean in project pinpoint by naver.

the class ServerInstanceListSerializerTest method createMapper.

private ObjectMapper createMapper() {
    final Jackson2ObjectMapperFactoryBean factoryBean = new Jackson2ObjectMapperFactoryBean();
    factoryBean.setHandlerInstantiator(new TestHandlerInstantiator());
    // TODO FIX spring managed object
    factoryBean.afterPropertiesSet();
    return factoryBean.getObject();
}
Also used : Jackson2ObjectMapperFactoryBean(org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean)

Example 2 with Jackson2ObjectMapperFactoryBean

use of org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean in project geode by apache.

the class RestInterfaceJUnitTest method getObjectMapper.

protected ObjectMapper getObjectMapper() {
    if (objectMapper == null) {
        Jackson2ObjectMapperFactoryBean objectMapperFactoryBean = new Jackson2ObjectMapperFactoryBean();
        objectMapperFactoryBean.setFailOnEmptyBeans(true);
        objectMapperFactoryBean.setFeaturesToEnable(Feature.ALLOW_COMMENTS);
        objectMapperFactoryBean.setFeaturesToEnable(Feature.ALLOW_SINGLE_QUOTES);
        objectMapperFactoryBean.setFeaturesToEnable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
        objectMapperFactoryBean.setFeaturesToDisable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
        objectMapperFactoryBean.setIndentOutput(true);
        objectMapperFactoryBean.setSimpleDateFormat("MM/dd/yyyy");
        objectMapperFactoryBean.afterPropertiesSet();
        objectMapper = objectMapperFactoryBean.getObject();
    }
    return objectMapper;
}
Also used : Jackson2ObjectMapperFactoryBean(org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean)

Example 3 with Jackson2ObjectMapperFactoryBean

use of org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean in project geode by apache.

the class RestTestUtils method createMappingJackson2HttpMessageConverter.

public static HttpMessageConverter<Object> createMappingJackson2HttpMessageConverter() {
    final Jackson2ObjectMapperFactoryBean objectMapperFactoryBean = new Jackson2ObjectMapperFactoryBean();
    objectMapperFactoryBean.setFailOnEmptyBeans(true);
    objectMapperFactoryBean.setIndentOutput(true);
    objectMapperFactoryBean.setDateFormat(new SimpleDateFormat("MM/dd/yyyy"));
    objectMapperFactoryBean.setFeaturesToDisable(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
    objectMapperFactoryBean.setFeaturesToEnable(com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_COMMENTS, com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_SINGLE_QUOTES, com.fasterxml.jackson.databind.DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
    objectMapperFactoryBean.afterPropertiesSet();
    final MappingJackson2HttpMessageConverter httpMessageConverter = new MappingJackson2HttpMessageConverter();
    httpMessageConverter.setObjectMapper(objectMapperFactoryBean.getObject());
    return httpMessageConverter;
}
Also used : MappingJackson2HttpMessageConverter(org.springframework.http.converter.json.MappingJackson2HttpMessageConverter) Jackson2ObjectMapperFactoryBean(org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

Jackson2ObjectMapperFactoryBean (org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean)3 SimpleDateFormat (java.text.SimpleDateFormat)1 MappingJackson2HttpMessageConverter (org.springframework.http.converter.json.MappingJackson2HttpMessageConverter)1