T - the converted object typepublic abstract class AbstractXmlHttpMessageConverter<T> extends AbstractHttpMessageConverter<T>
HttpMessageConverters
that convert from/to XML.
By default, subclasses of this converter support text/xml, application/xml, and application/*-xml. This can be overridden by setting the supportedMediaTypes property.
logger| Modifier | Constructor and Description |
|---|---|
protected |
AbstractXmlHttpMessageConverter()
Protected constructor that sets the
supportedMediaTypes
to text/xml and application/xml, and application/*-xml. |
| Modifier and Type | Method and Description |
|---|---|
protected abstract T |
readFromSource(Class<? extends T> clazz,
HttpHeaders headers,
Source source)
Abstract template method called from
AbstractHttpMessageConverter.read(Class, HttpInputMessage). |
T |
readInternal(Class<? extends T> clazz,
HttpInputMessage inputMessage)
Abstract template method that reads the actual object.
|
protected void |
transform(Source source,
Result result)
Transforms the given
Source to the Result. |
protected void |
writeInternal(T t,
HttpOutputMessage outputMessage)
Abstract template method that writes the actual body.
|
protected abstract void |
writeToResult(T t,
HttpHeaders headers,
Result result)
Abstract template method called from
writeInternal(Object, HttpOutputMessage). |
addDefaultHeaders, canRead, canRead, canWrite, canWrite, getContentLength, getDefaultCharset, getDefaultContentType, getSupportedMediaTypes, read, setDefaultCharset, setSupportedMediaTypes, supports, writeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetSupportedMediaTypesprotected AbstractXmlHttpMessageConverter()
supportedMediaTypes
to text/xml and application/xml, and application/*-xml.public final T readInternal(Class<? extends T> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException
AbstractHttpMessageConverterAbstractHttpMessageConverter.read(java.lang.Class<? extends T>, org.springframework.http.HttpInputMessage).readInternal in class AbstractHttpMessageConverter<T>clazz - the type of object to returninputMessage - the HTTP input message to read fromIOException - in case of I/O errorsHttpMessageNotReadableException - in case of conversion errorsprotected final void writeInternal(T t, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException
AbstractHttpMessageConverterAbstractHttpMessageConverter.write(T, org.springframework.http.MediaType, org.springframework.http.HttpOutputMessage).writeInternal in class AbstractHttpMessageConverter<T>t - the object to write to the output messageoutputMessage - the HTTP output message to write toIOException - in case of I/O errorsHttpMessageNotWritableException - in case of conversion errorsprotected void transform(Source source, Result result) throws TransformerException
Source to the Result.source - the source to transform fromresult - the result to transform toTransformerException - in case of transformation errorsprotected abstract T readFromSource(Class<? extends T> clazz, HttpHeaders headers, Source source) throws Exception
AbstractHttpMessageConverter.read(Class, HttpInputMessage).clazz - the type of object to returnheaders - the HTTP input headerssource - the HTTP input bodyException - in case of I/O or conversion errorsprotected abstract void writeToResult(T t, HttpHeaders headers, Result result) throws Exception
writeInternal(Object, HttpOutputMessage).t - the object to write to the output messageheaders - the HTTP output headersresult - the HTTP output bodyException - in case of I/O or conversion errors