类 AbstractXmlHttpMessageConverter<T>
- java.lang.Object
- org.springframework.http.converter.AbstractHttpMessageConverter<T>
- org.springframework.http.converter.xml.AbstractXmlHttpMessageConverter<T>
- 所有已实现的接口:
HttpMessageConverter<T>
public abstract class AbstractXmlHttpMessageConverter<T> extends AbstractHttpMessageConverter<T>
Abstract base class forHttpMessageConvertersthat convert from/to XML.By default, subclasses of this converter support
text/xml,application/xml, andapplication/*-xml. This can be overridden by setting thesupportedMediaTypesproperty.- 从以下版本开始:
- 3.0
- 作者:
- Arjen Poutsma
字段概要
从类继承的字段 org.springframework.http.converter.AbstractHttpMessageConverter
logger
构造器概要
构造器 限定符 构造器 说明 protectedAbstractXmlHttpMessageConverter()Protected constructor that sets thesupportedMediaTypestotext/xmlandapplication/xml, andapplication/*-xml.
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected abstract TreadFromSource(Class<? extends T> clazz, HttpHeaders headers, Source source)Abstract template method called fromAbstractHttpMessageConverter.read(Class, HttpInputMessage).TreadInternal(Class<? extends T> clazz, HttpInputMessage inputMessage)Abstract template method that reads the actual object.protected voidtransform(Source source, Result result)Transforms the givenSourceto theResult.protected 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).从类继承的方法 org.springframework.http.converter.AbstractHttpMessageConverter
addDefaultHeaders, canRead, canRead, canWrite, canWrite, getContentLength, getDefaultCharset, getDefaultContentType, getSupportedMediaTypes, read, setDefaultCharset, setSupportedMediaTypes, supports, write
构造器详细资料
AbstractXmlHttpMessageConverter
protected AbstractXmlHttpMessageConverter()
Protected constructor that sets thesupportedMediaTypestotext/xmlandapplication/xml, andapplication/*-xml.
方法详细资料
readInternal
public final T readInternal(Class<? extends T> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException
从类复制的说明:AbstractHttpMessageConverterAbstract template method that reads the actual object. Invoked fromAbstractHttpMessageConverter.read(java.lang.Class<? extends T>, org.springframework.http.HttpInputMessage).- 指定者:
readInternal在类中AbstractHttpMessageConverter<T>- 参数:
clazz- the type of object to returninputMessage- the HTTP input message to read from- 返回:
- the converted object
- 抛出:
IOException- in case of I/O errorsHttpMessageNotReadableException- in case of conversion errors
writeInternal
protected final void writeInternal(T t, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException
从类复制的说明:AbstractHttpMessageConverterAbstract template method that writes the actual body. Invoked fromAbstractHttpMessageConverter.write(T, org.springframework.http.MediaType, org.springframework.http.HttpOutputMessage).- 指定者:
writeInternal在类中AbstractHttpMessageConverter<T>- 参数:
t- the object to write to the output messageoutputMessage- the HTTP output message to write to- 抛出:
IOException- in case of I/O errorsHttpMessageNotWritableException- in case of conversion errors
transform
protected void transform(Source source, Result result) throws TransformerException
Transforms the givenSourceto theResult.- 参数:
source- the source to transform fromresult- the result to transform to- 抛出:
TransformerException- in case of transformation errors
readFromSource
protected abstract T readFromSource(Class<? extends T> clazz, HttpHeaders headers, Source source) throws IOException, HttpMessageNotReadableException
Abstract template method called fromAbstractHttpMessageConverter.read(Class, HttpInputMessage).- 参数:
clazz- the type of object to returnheaders- the HTTP input headerssource- the HTTP input body- 返回:
- the converted object
- 抛出:
IOException- in case of I/O errorsHttpMessageNotReadableException- in case of conversion errors
writeToResult
protected abstract void writeToResult(T t, HttpHeaders headers, Result result) throws IOException, HttpMessageNotWritableException
Abstract template method called fromwriteInternal(Object, HttpOutputMessage).- 参数:
t- the object to write to the output messageheaders- the HTTP output headersresult- the HTTP output body- 抛出:
IOException- in case of I/O errorsHttpMessageNotWritableException- in case of conversion errors