Class MarshallingHttpMessageConverter

All Implemented Interfaces:
HttpMessageConverter<Object>

public class MarshallingHttpMessageConverter extends AbstractXmlHttpMessageConverter<Object>
Implementation of HttpMessageConverter that can read and write XML using Spring's Marshaller and Unmarshaller abstractions.

This converter requires a Marshaller and Unmarshaller before it can be used. These can be injected by the constructor or bean properties.

By default, this converter supports text/xml and application/xml. This can be overridden by setting the supportedMediaTypes property.

Since:
3.0
Author:
Arjen Poutsma
  • Constructor Details

    • MarshallingHttpMessageConverter

      public MarshallingHttpMessageConverter()
      Construct a new MarshallingHttpMessageConverter with no Marshaller or Unmarshaller set. The Marshaller and Unmarshaller must be set after construction by invoking setMarshaller(Marshaller) and setUnmarshaller(Unmarshaller).
    • MarshallingHttpMessageConverter

      public MarshallingHttpMessageConverter(org.springframework.oxm.Marshaller marshaller)
      Construct a new MarshallingMessageConverter with the given Marshaller set.

      If the given Marshaller also implements the Unmarshaller interface, it is used for both marshalling and unmarshalling. Otherwise, an exception is thrown.

      Note that all Marshaller implementations in Spring also implement the Unmarshaller interface, so that you can safely use this constructor.

      Parameters:
      marshaller - object used as marshaller and unmarshaller
    • MarshallingHttpMessageConverter

      public MarshallingHttpMessageConverter(org.springframework.oxm.Marshaller marshaller, org.springframework.oxm.Unmarshaller unmarshaller)
      Construct a new MarshallingMessageConverter with the given Marshaller and Unmarshaller.
      Parameters:
      marshaller - the Marshaller to use
      unmarshaller - the Unmarshaller to use
  • Method Details