use of org.springframework.http.converter.StringHttpMessageConverter in project TranslateIt-api by zunpiau.
the class WebConfig method configureMessageConverters.
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
ArrayList<MediaType> mediaTypes = new ArrayList<>(2);
mediaTypes.add(new MediaType(MediaType.TEXT_PLAIN, StandardCharsets.UTF_8));
mediaTypes.add(new MediaType(MediaType.TEXT_HTML, StandardCharsets.UTF_8));
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(StandardCharsets.UTF_8);
stringHttpMessageConverter.setSupportedMediaTypes(mediaTypes);
MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
jackson2HttpMessageConverter.setSupportedMediaTypes(Collections.singletonList(MediaType.APPLICATION_JSON));
converters.add(stringHttpMessageConverter);
converters.add(jackson2HttpMessageConverter);
}
use of org.springframework.http.converter.StringHttpMessageConverter in project thingsboard by thingsboard.
the class AbstractControllerTest method json.
@SuppressWarnings("unchecked")
protected String json(Object o) throws IOException {
MockHttpOutputMessage mockHttpOutputMessage = new MockHttpOutputMessage();
HttpMessageConverter converter = o instanceof String ? stringHttpMessageConverter : mappingJackson2HttpMessageConverter;
converter.write(o, MediaType.APPLICATION_JSON, mockHttpOutputMessage);
return mockHttpOutputMessage.getBodyAsString();
}
use of org.springframework.http.converter.StringHttpMessageConverter in project codekvast by crispab.
the class DashboardApiControllerTest method setup.
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
DashboardApiController dashboardApiController = new DashboardApiController(dashboardService, settings);
this.mockMvc = MockMvcBuilders.standaloneSetup(dashboardApiController).setMessageConverters(new GsonHttpMessageConverter(), new StringHttpMessageConverter()).build();
}
use of org.springframework.http.converter.StringHttpMessageConverter in project molgenis by molgenis.
the class HttpClientConfig method converters.
private List<HttpMessageConverter<?>> converters() {
List<HttpMessageConverter<?>> result = Lists.newArrayList();
result.add(new ByteArrayHttpMessageConverter());
result.add(new StringHttpMessageConverter());
result.add(new ResourceHttpMessageConverter());
result.add(new SourceHttpMessageConverter<>());
result.add(new AllEncompassingFormHttpMessageConverter());
result.add(new Jaxb2RootElementHttpMessageConverter());
result.add(gsonHttpMessageConverter);
return result;
}
use of org.springframework.http.converter.StringHttpMessageConverter in project osms by malikov-yurii.
the class SpringMvc method configureMessageConverters.
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
stringHttpMessageConverter.setSupportedMediaTypes((Arrays.asList(MediaType.valueOf("text/plain;charset=UTF-8"), MediaType.valueOf("text/html;charset=UTF-8"))));
converters.add(stringHttpMessageConverter);
converters.add(converter());
}
Aggregations