Package org.springframework.http.converter.json

Examples of org.springframework.http.converter.json.MappingJacksonHttpMessageConverter


    {"longUrl": "http://www.google.com/"}
       */
      RestTemplate template = new RestTemplate();
      List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
     messageConverters.add(new MappingJacksonHttpMessageConverter());
      template.setMessageConverters(messageConverters);
         //now we need to add the parameters
      String apiKey = this.searchConfigRetriever.getArbitrary("googleAPIKey");

       LinkShortenRequestGoogle postObject = new LinkShortenRequestGoogle(longUrl);
View Full Code Here


    return new JacksonObjectMapper();
  }
 
  @Bean
  public MappingJacksonHttpMessageConverter jsonHttpMessageConverter() {
    MappingJacksonHttpMessageConverter converter = new MappingJacksonHttpMessageConverter();
    converter.setObjectMapper(jacksonObjectMapper());
    return converter;
  }
View Full Code Here

        return objectMapper;
    }

    private RestTemplate createRestTemplate() {
        // jackson message converter
        MappingJacksonHttpMessageConverter mappingJacksonHttpMessageConverter = new MappingJacksonHttpMessageConverter();
        mappingJacksonHttpMessageConverter.setObjectMapper(objectMapper);

        // create message converters list
        List<HttpMessageConverter<?>> httpMessageConverters = new ArrayList<HttpMessageConverter<?>>();
        httpMessageConverters.add(mappingJacksonHttpMessageConverter);
View Full Code Here

     */
    private RestTemplate getRestJsonTemplate(){
        RestTemplate restTemplate = new RestTemplate();
        List<HttpMessageConverter<?>> mc = restTemplate.getMessageConverters();
        // Add JSON message handler
        MappingJacksonHttpMessageConverter json = new MappingJacksonHttpMessageConverter();
        List<MediaType> supportedMediaTypes = new ArrayList<MediaType>();
        supportedMediaTypes.add(new MediaType("application","json", Charset.forName("UTF-8")));
        // Add default media type in case marketplace uses incorrect MIME type, otherwise
        // Spring refuses to process it, even if its valid JSON
        supportedMediaTypes.add(new MediaType("application","octet-stream", Charset.forName("UTF-8")));
        json.setSupportedMediaTypes(supportedMediaTypes);
        mc.add(json);
        restTemplate.setMessageConverters(mc);
        return restTemplate;
    }
View Full Code Here

    private void registerDropboxJsonModule(RestTemplate restTemplate) {
        List<HttpMessageConverter<?>> converters = restTemplate.getMessageConverters();

        for (HttpMessageConverter<?> converter : converters) {
            if (converter instanceof MappingJacksonHttpMessageConverter) {
                MappingJacksonHttpMessageConverter jsonConverter = (MappingJacksonHttpMessageConverter) converter;

                objectMapper = new ObjectMapper();
                objectMapper.registerModule(new DropboxModule());
                jsonConverter.setObjectMapper(objectMapper);
            }
        }
    }
View Full Code Here

    }
    if (jackson2Present) {
      this.messageConverters.add(new MappingJackson2HttpMessageConverter());
    }
    else if (jacksonPresent) {
      this.messageConverters.add(new MappingJacksonHttpMessageConverter());
    }
  }
View Full Code Here

    }
    if (jackson2Present) {
      addPartConverter(new MappingJackson2HttpMessageConverter());
    }
    else if (jacksonPresent) {
      addPartConverter(new MappingJacksonHttpMessageConverter());
    }
  }
View Full Code Here

    ClassLoader classLoader = getClass().getClassLoader();
    if (ClassUtils.isPresent("javax.xml.bind.Binder", classLoader)) {
      messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
    }
    if (ClassUtils.isPresent("org.codehaus.jackson.map.ObjectMapper", classLoader)) {
      messageConverters.add(new MappingJacksonHttpMessageConverter());
    }
    if (ClassUtils.isPresent("com.sun.syndication.feed.WireFeed", classLoader)) {
      messageConverters.add(new AtomFeedHttpMessageConverter());
      messageConverters.add(new RssChannelHttpMessageConverter());
    }
View Full Code Here

    this.messageConverters.add(new XmlAwareFormHttpMessageConverter());
    if (jaxb2Present) {
      this.messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
    }
    if (jacksonPresent) {
      this.messageConverters.add(new MappingJacksonHttpMessageConverter());
    }
    if (romePresent) {
      this.messageConverters.add(new AtomFeedHttpMessageConverter());
      this.messageConverters.add(new RssChannelHttpMessageConverter());
    }
View Full Code Here

    }
    if (jackson2Present) {
      messageConverters.add(new MappingJackson2HttpMessageConverter());
    }
    else if (jacksonPresent) {
      messageConverters.add(new MappingJacksonHttpMessageConverter());
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.http.converter.json.MappingJacksonHttpMessageConverter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.