类 AbstractXmlHttpMessageConverter<T>
- java.lang.Object
- org.springframework.http.converter.AbstractHttpMessageConverter<T>
- org.springframework.http.converter.xml.AbstractXmlHttpMessageConverter<T>
- 类型参数:
T
- the converted object type
- 所有已实现的接口:
HttpMessageConverter<T>
public abstract class AbstractXmlHttpMessageConverter<T> extends AbstractHttpMessageConverter<T>
Abstract base class forHttpMessageConverters
that convert from/to XML.By default, subclasses of this converter support
text/xml
,application/xml
, andapplication/*-xml
. This can be overridden by setting thesupportedMediaTypes
property.- 从以下版本开始:
- 3.0
- 作者:
- Arjen Poutsma, Juergen Hoeller
字段概要
从类继承的字段 org.springframework.http.converter.AbstractHttpMessageConverter
logger
构造器概要
构造器 限定符 构造器 说明 protected
AbstractXmlHttpMessageConverter()
Protected constructor that sets thesupportedMediaTypes
totext/xml
andapplication/xml
, andapplication/*-xml
.
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected abstract T
readFromSource(Class<? extends T> clazz, HttpHeaders headers, Source source)
Abstract template method called fromAbstractHttpMessageConverter.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 givenSource
to theResult
.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 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 thesupportedMediaTypes
totext/xml
andapplication/xml
, andapplication/*-xml
.
方法详细资料
readInternal
public final T readInternal(Class<? extends T> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException
从类复制的说明:AbstractHttpMessageConverter
Abstract 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
从类复制的说明:AbstractHttpMessageConverter
Abstract 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 givenSource
to 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 Exception
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
- 抛出:
Exception
- in case of I/O or conversion errors
writeToResult
protected abstract void writeToResult(T t, HttpHeaders headers, Result result) throws Exception
Abstract template method called fromwriteInternal(Object, HttpOutputMessage)
.- 参数:
t
- the object to write to the output messageheaders
- the HTTP output headersresult
- the HTTP output body- 抛出:
Exception
- in case of I/O or conversion errors