Beispiel #1
0
 /** configure json converter charset to UTF-8 */
 @Override
 public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
   converters.add(new StringHttpMessageConverter(UTF8));
   converters.add(new ByteArrayHttpMessageConverter());
   converters.add(jacksonMessageConverter());
   super.configureMessageConverters(converters);
 }
  public void configureMessageConverters(List<HttpMessageConverter<?>> messageConverters) {

    MappingJackson2HttpMessageConverter jmc = new MappingJackson2HttpMessageConverter();
    jmc.setObjectMapper(new JSONObjectMapper());
    messageConverters.add(jmc);
    messageConverters.add(createXmlHttpMessageConverter());
    super.configureMessageConverters(messageConverters);
  }
Beispiel #3
0
  @Override
  public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {

    System.out.println("AppConfig.configureMessageConverters()----------------配置转换器");
    final FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
    List<MediaType> supportedMediaTypes = new ArrayList<MediaType>();
    supportedMediaTypes.add(new MediaType("text", "plain"));
    supportedMediaTypes.add(new MediaType("application", "json"));
    converter.setSupportedMediaTypes(supportedMediaTypes);
    converters.add(converter);
    super.configureMessageConverters(converters);
  }
Beispiel #4
0
  @Override
  public void configureMessageConverters(final List<HttpMessageConverter<?>> messageConverters) {
    messageConverters.add(marshallingHttpMessageConverter());

    final ClassLoader classLoader = getClass().getClassLoader();
    if (ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", classLoader)) {
      messageConverters.add(new MappingJackson2HttpMessageConverter());
    } else if (ClassUtils.isPresent("org.codehaus.jackson.map.ObjectMapper", classLoader)) {
      messageConverters.add(new MappingJacksonHttpMessageConverter());
    }

    super.configureMessageConverters(messageConverters);
  }
Beispiel #5
0
 @Override
 public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
   converters.add(new MappingJackson2HttpMessageConverter());
   super.configureMessageConverters(converters);
 }