org.springframework.http.converter

Class ObjectToStringHttpMessageConverter

  • All Implemented Interfaces:
    HttpMessageConverter<java.lang.Object>


    public class ObjectToStringHttpMessageConverter
    extends AbstractHttpMessageConverter<java.lang.Object>
    An HttpMessageConverter that uses StringHttpMessageConverter for reading and writing content and a ConversionService for converting the String content to and from the target object type.

    By default, this converter supports the media type text/plain only. This can be overridden through the supportedMediaTypes property.

    A usage example:

     <bean class="org.springframework.http.converter.ObjectToStringHttpMessageConverter">
       <constructor-arg>
         <bean class="org.springframework.context.support.ConversionServiceFactoryBean"/>
       </constructor-arg>
     </bean>
     
    Since:
    3.2
    Author:
    Dmitry Katsubo, Rossen Stoyanchev