Class AbstractXmlHttpMessageConverter<T>
java.lang.Object
org.springframework.http.converter.AbstractHttpMessageConverter<T>
org.springframework.http.converter.xml.AbstractXmlHttpMessageConverter<T>
- Type Parameters:
- T- the converted object type
- All Implemented Interfaces:
- HttpMessageConverter<T>
- Direct Known Subclasses:
- AbstractJaxb2HttpMessageConverter,- MarshallingHttpMessageConverter
Abstract base class for 
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.
- Since:
- 3.0
- Author:
- Arjen Poutsma, Juergen Hoeller
- 
Field SummaryFields inherited from class org.springframework.http.converter.AbstractHttpMessageConverterlogger
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedProtected constructor that sets thesupportedMediaTypestotext/xmlandapplication/xml, andapplication/*-xml.
- 
Method SummaryModifier and TypeMethodDescriptionprotected abstract TreadFromSource(Class<? extends T> clazz, HttpHeaders headers, Source source) Abstract template method called fromAbstractHttpMessageConverter.read(Class, HttpInputMessage).final TreadInternal(Class<? extends T> clazz, HttpInputMessage inputMessage) Abstract template method that reads the actual object.protected voidTransforms the givenSourceto theResult.protected final voidwriteInternal(T t, HttpOutputMessage outputMessage) Abstract template method that writes the actual body.protected abstract voidwriteToResult(T t, HttpHeaders headers, Result result) Abstract template method called fromwriteInternal(Object, HttpOutputMessage).Methods inherited from class org.springframework.http.converter.AbstractHttpMessageConverteraddDefaultHeaders, canRead, canRead, canWrite, canWrite, getContentLength, getDefaultCharset, getDefaultContentType, getSupportedMediaTypes, read, setDefaultCharset, setSupportedMediaTypes, supports, writeMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.http.converter.HttpMessageConvertergetSupportedMediaTypes
- 
Constructor Details- 
AbstractXmlHttpMessageConverterprotected AbstractXmlHttpMessageConverter()Protected constructor that sets thesupportedMediaTypestotext/xmlandapplication/xml, andapplication/*-xml.
 
- 
- 
Method Details- 
readInternalpublic final T readInternal(Class<? extends T> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException Description copied from class:AbstractHttpMessageConverterAbstract template method that reads the actual object. Invoked fromAbstractHttpMessageConverter.read(java.lang.Class<? extends T>, org.springframework.http.HttpInputMessage).- Specified by:
- readInternalin class- AbstractHttpMessageConverter<T>
- Parameters:
- clazz- the type of object to return
- inputMessage- the HTTP input message to read from
- Returns:
- the converted object
- Throws:
- IOException- in case of I/O errors
- HttpMessageNotReadableException- in case of conversion errors
 
- 
writeInternalprotected final void writeInternal(T t, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException Description copied from class:AbstractHttpMessageConverterAbstract template method that writes the actual body. Invoked fromAbstractHttpMessageConverter.write(T, org.springframework.http.MediaType, org.springframework.http.HttpOutputMessage).- Specified by:
- writeInternalin class- AbstractHttpMessageConverter<T>
- Parameters:
- t- the object to write to the output message
- outputMessage- the HTTP output message to write to
- Throws:
- IOException- in case of I/O errors
- HttpMessageNotWritableException- in case of conversion errors
 
- 
transformTransforms the givenSourceto theResult.- Parameters:
- source- the source to transform from
- result- the result to transform to
- Throws:
- TransformerException- in case of transformation errors
 
- 
readFromSourceprotected abstract T readFromSource(Class<? extends T> clazz, HttpHeaders headers, Source source) throws Exception Abstract template method called fromAbstractHttpMessageConverter.read(Class, HttpInputMessage).- Parameters:
- clazz- the type of object to return
- headers- the HTTP input headers
- source- the HTTP input body
- Returns:
- the converted object
- Throws:
- Exception- in case of I/O or conversion errors
 
- 
writeToResultAbstract template method called fromwriteInternal(Object, HttpOutputMessage).- Parameters:
- t- the object to write to the output message
- headers- the HTTP output headers
- result- the HTTP output body
- Throws:
- Exception- in case of I/O or conversion errors
 
 
-