org.springframework.http.converter.AbstractHttpMessageConverter Java Examples
The following examples show how to use
org.springframework.http.converter.AbstractHttpMessageConverter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RestTemplateBuilder.java From carina with Apache License 2.0 | 6 votes |
public RestTemplateBuilder withSpecificJsonMessageConverter() { isUseDefaultJsonMessageConverter = false; AbstractHttpMessageConverter<?> jsonMessageConverter = new MappingJackson2HttpMessageConverter( Jackson2ObjectMapperBuilder .json() .featuresToEnable( DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT) .build()); jsonMessageConverter.setSupportedMediaTypes(Lists.newArrayList( MediaType.TEXT_HTML, MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON)); withMessageConverter(jsonMessageConverter); return this; }
Example #2
Source File: ExtRestTemplate.java From onetwo with Apache License 2.0 | 5 votes |
private void applyDefaultCharset() { for (HttpMessageConverter<?> candidate : this.getMessageConverters()) { if (candidate instanceof AbstractHttpMessageConverter) { AbstractHttpMessageConverter<?> converter = (AbstractHttpMessageConverter<?>) candidate; if (converter.getDefaultCharset() != null) { converter.setDefaultCharset(this.charset); } } } }
Example #3
Source File: FormHttpMessageConverter.java From onetwo with Apache License 2.0 | 5 votes |
/** * Apply the configured charset as a default to registered part converters. */ private void applyDefaultCharset() { for (HttpMessageConverter<?> candidate : this.partConverters) { if (candidate instanceof AbstractHttpMessageConverter) { AbstractHttpMessageConverter<?> converter = (AbstractHttpMessageConverter<?>) candidate; // Only override default charset if the converter operates with a charset to begin with... if (converter.getDefaultCharset() != null) { converter.setDefaultCharset(this.charset); } } } }
Example #4
Source File: MappingJackson2XmlHttpMessageConverterTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
private void writeInternal(Object object, HttpOutputMessage outputMessage) throws Exception { Method method = AbstractHttpMessageConverter.class.getDeclaredMethod( "writeInternal", Object.class, HttpOutputMessage.class); method.setAccessible(true); method.invoke(this.converter, object, outputMessage); }