Search in sources :

Example 51 with HttpMessageConverter

use of org.springframework.http.converter.HttpMessageConverter in project robospice by stephanenicolas.

the class GsonSpringAndroidSpiceService method createRestTemplate.

@Override
public RestTemplate createRestTemplate() {
    RestTemplate restTemplate = new RestTemplate();
    // web services support json responses
    GsonHttpMessageConverter jsonConverter = new GsonHttpMessageConverter();
    final List<HttpMessageConverter<?>> listHttpMessageConverters = restTemplate.getMessageConverters();
    listHttpMessageConverters.add(jsonConverter);
    restTemplate.setMessageConverters(listHttpMessageConverters);
    return restTemplate;
}
Also used : RestTemplate(org.springframework.web.client.RestTemplate) HttpMessageConverter(org.springframework.http.converter.HttpMessageConverter) GsonHttpMessageConverter(org.springframework.http.converter.json.GsonHttpMessageConverter) GsonHttpMessageConverter(org.springframework.http.converter.json.GsonHttpMessageConverter)

Example 52 with HttpMessageConverter

use of org.springframework.http.converter.HttpMessageConverter in project robospice by stephanenicolas.

the class Jackson2SpringAndroidSpiceService method createRestTemplate.

@Override
public RestTemplate createRestTemplate() {
    RestTemplate restTemplate = new RestTemplate();
    // web services support json responses
    MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
    final List<HttpMessageConverter<?>> listHttpMessageConverters = restTemplate.getMessageConverters();
    listHttpMessageConverters.add(jsonConverter);
    restTemplate.setMessageConverters(listHttpMessageConverters);
    return restTemplate;
}
Also used : MappingJackson2HttpMessageConverter(org.springframework.http.converter.json.MappingJackson2HttpMessageConverter) RestTemplate(org.springframework.web.client.RestTemplate) MappingJackson2HttpMessageConverter(org.springframework.http.converter.json.MappingJackson2HttpMessageConverter) HttpMessageConverter(org.springframework.http.converter.HttpMessageConverter)

Example 53 with HttpMessageConverter

use of org.springframework.http.converter.HttpMessageConverter in project spring-framework by spring-projects.

the class ContentRequestMatchersIntegrationTests method setup.

@Before
public void setup() {
    List<HttpMessageConverter<?>> converters = new ArrayList<>();
    converters.add(new StringHttpMessageConverter());
    converters.add(new MappingJackson2HttpMessageConverter());
    this.restTemplate = new RestTemplate();
    this.restTemplate.setMessageConverters(converters);
    this.mockServer = MockRestServiceServer.createServer(this.restTemplate);
}
Also used : MappingJackson2HttpMessageConverter(org.springframework.http.converter.json.MappingJackson2HttpMessageConverter) ArrayList(java.util.ArrayList) StringHttpMessageConverter(org.springframework.http.converter.StringHttpMessageConverter) MappingJackson2HttpMessageConverter(org.springframework.http.converter.json.MappingJackson2HttpMessageConverter) HttpMessageConverter(org.springframework.http.converter.HttpMessageConverter) RestTemplate(org.springframework.web.client.RestTemplate) StringHttpMessageConverter(org.springframework.http.converter.StringHttpMessageConverter) Before(org.junit.Before)

Example 54 with HttpMessageConverter

use of org.springframework.http.converter.HttpMessageConverter in project spring-framework by spring-projects.

the class HeaderRequestMatchersIntegrationTests method setup.

@Before
public void setup() {
    List<HttpMessageConverter<?>> converters = new ArrayList<>();
    converters.add(new StringHttpMessageConverter());
    converters.add(new MappingJackson2HttpMessageConverter());
    this.restTemplate = new RestTemplate();
    this.restTemplate.setMessageConverters(converters);
    this.mockServer = MockRestServiceServer.createServer(this.restTemplate);
}
Also used : MappingJackson2HttpMessageConverter(org.springframework.http.converter.json.MappingJackson2HttpMessageConverter) ArrayList(java.util.ArrayList) StringHttpMessageConverter(org.springframework.http.converter.StringHttpMessageConverter) MappingJackson2HttpMessageConverter(org.springframework.http.converter.json.MappingJackson2HttpMessageConverter) HttpMessageConverter(org.springframework.http.converter.HttpMessageConverter) RestTemplate(org.springframework.web.client.RestTemplate) StringHttpMessageConverter(org.springframework.http.converter.StringHttpMessageConverter) Before(org.junit.Before)

Example 55 with HttpMessageConverter

use of org.springframework.http.converter.HttpMessageConverter in project spring-framework by spring-projects.

the class XmlContentRequestMatchersIntegrationTests method setup.

@Before
public void setup() {
    List<Person> composers = Arrays.asList(new Person("Johann Sebastian Bach").setSomeDouble(21), new Person("Johannes Brahms").setSomeDouble(.0025), new Person("Edvard Grieg").setSomeDouble(1.6035), new Person("Robert Schumann").setSomeDouble(Double.NaN));
    this.people = new PeopleWrapper(composers);
    List<HttpMessageConverter<?>> converters = new ArrayList<>();
    converters.add(new Jaxb2RootElementHttpMessageConverter());
    this.restTemplate = new RestTemplate();
    this.restTemplate.setMessageConverters(converters);
    this.mockServer = MockRestServiceServer.createServer(this.restTemplate);
}
Also used : Jaxb2RootElementHttpMessageConverter(org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter) ArrayList(java.util.ArrayList) HttpMessageConverter(org.springframework.http.converter.HttpMessageConverter) Jaxb2RootElementHttpMessageConverter(org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter) RestTemplate(org.springframework.web.client.RestTemplate) Person(org.springframework.test.web.Person) Before(org.junit.Before)

Aggregations

HttpMessageConverter (org.springframework.http.converter.HttpMessageConverter)95 ArrayList (java.util.ArrayList)66 Test (org.junit.Test)62 StringHttpMessageConverter (org.springframework.http.converter.StringHttpMessageConverter)59 MappingJackson2HttpMessageConverter (org.springframework.http.converter.json.MappingJackson2HttpMessageConverter)51 ByteArrayHttpMessageConverter (org.springframework.http.converter.ByteArrayHttpMessageConverter)37 MappingJackson2XmlHttpMessageConverter (org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter)33 ResourceHttpMessageConverter (org.springframework.http.converter.ResourceHttpMessageConverter)32 AllEncompassingFormHttpMessageConverter (org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter)30 RestTemplate (org.springframework.web.client.RestTemplate)29 Method (java.lang.reflect.Method)25 MethodParameter (org.springframework.core.MethodParameter)25 HandlerMethod (org.springframework.web.method.HandlerMethod)24 AnnotationConfigWebApplicationContext (org.springframework.web.context.support.AnnotationConfigWebApplicationContext)14 SerDeHttpMessageConverter (com.kixeye.chassis.transport.http.SerDeHttpMessageConverter)13 MessageSerDe (com.kixeye.chassis.transport.serde.MessageSerDe)13 URI (java.net.URI)13 HashMap (java.util.HashMap)13 MapPropertySource (org.springframework.core.env.MapPropertySource)13 StandardEnvironment (org.springframework.core.env.StandardEnvironment)13