public class SourceHttpMessageConverter<T extends javax.xml.transform.Source> extends AbstractXmlHttpMessageConverter<T>
HttpMessageConverter
that can read and write Source
objects.Constructor and Description |
---|
SourceHttpMessageConverter() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.Long |
getContentLength(T t,
MediaType contentType)
Returns the content length for the given type.
|
protected T |
readFromSource(java.lang.Class<? extends T> clazz,
HttpHeaders headers,
javax.xml.transform.Source source)
Abstract template method called from
AbstractHttpMessageConverter.read(Class, HttpInputMessage) . |
boolean |
supports(java.lang.Class<?> clazz)
Indicates whether the given class is supported by this converter.
|
protected void |
writeToResult(T t,
HttpHeaders headers,
javax.xml.transform.Result result)
Abstract template method called from
AbstractXmlHttpMessageConverter.writeInternal(Object, HttpOutputMessage) . |
readInternal, transform, writeInternal
canRead, canRead, canWrite, canWrite, getDefaultContentType, getSupportedMediaTypes, read, setSupportedMediaTypes, write
public boolean supports(java.lang.Class<?> clazz)
AbstractHttpMessageConverter
supports
in class AbstractHttpMessageConverter<T extends javax.xml.transform.Source>
clazz
- the class to test for supporttrue
if supported; false
otherwiseprotected T readFromSource(java.lang.Class<? extends T> clazz, HttpHeaders headers, javax.xml.transform.Source source) throws java.io.IOException
AbstractXmlHttpMessageConverter
AbstractHttpMessageConverter.read(Class, HttpInputMessage)
.readFromSource
in class AbstractXmlHttpMessageConverter<T extends javax.xml.transform.Source>
clazz
- the type of object to returnheaders
- the HTTP input headerssource
- the HTTP input bodyjava.io.IOException
- in case of I/O errorsprotected java.lang.Long getContentLength(T t, MediaType contentType)
AbstractHttpMessageConverter
By default, this returns null
, meaning that the content length is unknown.
Can be overridden in subclasses.
getContentLength
in class AbstractHttpMessageConverter<T extends javax.xml.transform.Source>
t
- the type to return the content length fornull
if not knownprotected void writeToResult(T t, HttpHeaders headers, javax.xml.transform.Result result) throws java.io.IOException
AbstractXmlHttpMessageConverter
AbstractXmlHttpMessageConverter.writeInternal(Object, HttpOutputMessage)
.writeToResult
in class AbstractXmlHttpMessageConverter<T extends javax.xml.transform.Source>
t
- the object to write to the output messageheaders
- the HTTP output headersresult
- the HTTP output bodyjava.io.IOException
- in case of I/O errors