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.
| Modifier and Type | Field and Description |
|---|---|
| private Marshaller | |
| private Unmarshaller |
| Access | Constructor and Description |
|---|---|
| public | MarshallingHttpMessageConverter()
Construct a new |
| public | MarshallingHttpMessageConverter(Marshaller
object used as marshaller and unmarshaller marshaller)Construct a new |
| public | MarshallingHttpMessageConverter(Marshaller
the Marshaller to use marshaller, Unmarshaller the Unmarshaller to use unmarshaller)Construct a new |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | canRead(Class<?>
the class to test for readability clazz, MediaType the media type to read (can be mediaType)null if not specified);
typically the value of a Content-Type header.Overrides org. Implements org. |
| public boolean | canWrite(Class<?>
the class to test for writability clazz, MediaType the media type to write (can be mediaType)null if not specified);
typically the value of an Accept header.Overrides org. Implements org. |
| protected Object | readFromSource(Class<?>
the type of object to return clazz, HttpHeaders the HTTP input headers headers, Source the HTTP input body source)Implements abstract org. read(Class, HttpInputMessage).
|
| public void | |
| public void | setUnmarshaller(Unmarshaller unmarshaller)
Set the |
| protected boolean | supports(Class<?>
the class to test for support clazz)Implements abstract org. |
| protected boolean | supportsRepeatableWrites(Object
the object t o)Overrides org. |
| protected void | writeToResult(Object
the object to write to the output message o, HttpHeaders the HTTP output headers headers, Result the HTTP output body result)Implements abstract org. writeInternal(Object, HttpOutputMessage).
|
| marshaller | back to summary |
|---|---|
| private Marshaller marshaller
| |
| unmarshaller | back to summary |
|---|---|
| private Unmarshaller unmarshaller
| |
| MarshallingHttpMessageConverter | back to summary |
|---|---|
| public MarshallingHttpMessageConverter() Construct a new | |
| MarshallingHttpMessageConverter | back to summary |
|---|---|
| public MarshallingHttpMessageConverter(Marshaller marshaller) Construct a new If the given Note that all
| |
| MarshallingHttpMessageConverter | back to summary |
|---|---|
| public MarshallingHttpMessageConverter(Marshaller marshaller, Unmarshaller unmarshaller) Construct a new
| |
| canRead | back to summary |
|---|---|
| public boolean canRead(Class<?> clazz, MediaType mediaType) Overrides org. Implements org. Doc from org. This implementation checks if the given class is supported, and if the supported media types include the given media type.
| |
| canWrite | back to summary |
|---|---|
| public boolean canWrite(Class<?> clazz, MediaType mediaType) Overrides org. Implements org. Doc from org. This implementation checks if the given class is supported, and if the supported media types include the given media type.
| |
| readFromSource | back to summary |
|---|---|
| protected Object readFromSource(Class<?> clazz, HttpHeaders headers, Source source) throws Exception Implements abstract org. Doc from org. Abstract template method called from | |
| setMarshaller | back to summary |
|---|---|
| public void setMarshaller(Marshaller marshaller) Set the | |
| setUnmarshaller | back to summary |
|---|---|
| public void setUnmarshaller(Unmarshaller unmarshaller) Set the | |
| supports | back to summary |
|---|---|
| protected boolean supports(Class<?> clazz) Implements abstract org. Doc from org. Indicates whether the given class is supported by this converter. | |
| supportsRepeatableWrites | back to summary |
|---|---|
| protected boolean supportsRepeatableWrites(Object o) Overrides org. Doc from org. Indicates whether this message converter can write the given object multiple times. Default implementation returns | |
| writeToResult | back to summary |
|---|---|
| protected void writeToResult(Object o, HttpHeaders headers, Result result) throws Exception Implements abstract org. Doc from org. Abstract template method called from
| |