Search in sources :

Example 91 with HttpMessageConverter

use of org.springframework.http.converter.HttpMessageConverter in project dhis2-core by dhis2.

the class MessageConverterAddingPostProcessor method postProcessAfterInitialization.

@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
    if (!(bean instanceof RequestMappingHandlerAdapter)) {
        return bean;
    }
    RequestMappingHandlerAdapter handlerAdapter = (RequestMappingHandlerAdapter) bean;
    List<HttpMessageConverter<?>> converters = handlerAdapter.getMessageConverters();
    converters.add(0, messageConverter);
    handlerAdapter.setMessageConverters(converters);
    return handlerAdapter;
}
Also used : HttpMessageConverter(org.springframework.http.converter.HttpMessageConverter) RequestMappingHandlerAdapter(org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter)

Aggregations

HttpMessageConverter (org.springframework.http.converter.HttpMessageConverter)91 ArrayList (java.util.ArrayList)65 Test (org.junit.Test)62 StringHttpMessageConverter (org.springframework.http.converter.StringHttpMessageConverter)57 MappingJackson2HttpMessageConverter (org.springframework.http.converter.json.MappingJackson2HttpMessageConverter)49 ByteArrayHttpMessageConverter (org.springframework.http.converter.ByteArrayHttpMessageConverter)37 ResourceHttpMessageConverter (org.springframework.http.converter.ResourceHttpMessageConverter)32 MappingJackson2XmlHttpMessageConverter (org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter)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