public class Jaxb2RootElementHttpMessageConverter extends AbstractJaxb2HttpMessageConverter<java.lang.Object>
HttpMessageConverter that can read
and write XML using JAXB2.
This converter can read classes annotated with XmlRootElement and XmlType, and write classes
annotated with with XmlRootElement, or subclasses thereof.
logger| Constructor and Description |
|---|
Jaxb2RootElementHttpMessageConverter() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRead(java.lang.Class<?> clazz,
MediaType mediaType)
This implementation checks if the given class is supported,
and if the supported media types
include the given media type.
|
boolean |
canWrite(java.lang.Class<?> clazz,
MediaType mediaType)
This implementation checks if the given class is supported,
and if the supported media types
include the given media type.
|
protected java.lang.Object |
readFromSource(java.lang.Class<?> clazz,
HttpHeaders headers,
javax.xml.transform.Source source)
Abstract template method called from
AbstractHttpMessageConverter.read(Class, HttpInputMessage). |
protected boolean |
supports(java.lang.Class<?> clazz)
Indicates whether the given class is supported by this converter.
|
protected void |
writeToResult(java.lang.Object o,
HttpHeaders headers,
javax.xml.transform.Result result)
Abstract template method called from
AbstractXmlHttpMessageConverter.writeInternal(Object, HttpOutputMessage). |
createMarshaller, createUnmarshaller, getJaxbContextreadInternal, transform, writeInternalcanRead, canWrite, getContentLength, getDefaultContentType, getSupportedMediaTypes, read, setSupportedMediaTypes, writepublic Jaxb2RootElementHttpMessageConverter()
public boolean canRead(java.lang.Class<?> clazz,
MediaType mediaType)
AbstractHttpMessageConvertercanRead in interface HttpMessageConverter<java.lang.Object>canRead in class AbstractHttpMessageConverter<java.lang.Object>clazz - the class to test for readabilitymediaType - the media type to read, can be null if not specified.
Typically the value of a Content-Type header.true if readable; false otherwisepublic boolean canWrite(java.lang.Class<?> clazz,
MediaType mediaType)
AbstractHttpMessageConvertercanWrite in interface HttpMessageConverter<java.lang.Object>canWrite in class AbstractHttpMessageConverter<java.lang.Object>clazz - the class to test for writabilitymediaType - the media type to write, can be null if not specified.
Typically the value of an Accept header.true if writable; false otherwiseprotected boolean supports(java.lang.Class<?> clazz)
AbstractHttpMessageConvertersupports in class AbstractHttpMessageConverter<java.lang.Object>clazz - the class to test for supporttrue if supported; false otherwiseprotected java.lang.Object readFromSource(java.lang.Class<?> clazz,
HttpHeaders headers,
javax.xml.transform.Source source)
throws java.io.IOException
AbstractXmlHttpMessageConverterAbstractHttpMessageConverter.read(Class, HttpInputMessage).readFromSource in class AbstractXmlHttpMessageConverter<java.lang.Object>clazz - the type of object to returnheaders - the HTTP input headerssource - the HTTP input bodyjava.io.IOException - in case of I/O errorsprotected void writeToResult(java.lang.Object o,
HttpHeaders headers,
javax.xml.transform.Result result)
throws java.io.IOException
AbstractXmlHttpMessageConverterAbstractXmlHttpMessageConverter.writeInternal(Object, HttpOutputMessage).writeToResult in class AbstractXmlHttpMessageConverter<java.lang.Object>o - the object to write to the output messageheaders - the HTTP output headersresult - the HTTP output bodyjava.io.IOException - in case of I/O errors