public class SourceHttpMessageConverter<T extends Source> extends AbstractXmlHttpMessageConverter<T>
HttpMessageConverter
that can read and write Source
objects.logger
Constructor and Description |
---|
SourceHttpMessageConverter() |
Modifier and Type | Method and Description |
---|---|
protected Long |
getContentLength(T t,
MediaType contentType)
Returns the content length for the given type.
|
protected T |
readFromSource(Class clazz,
HttpHeaders headers,
Source source)
Abstract template method called from
AbstractHttpMessageConverter.read(Class, HttpInputMessage) . |
boolean |
supports(Class<?> clazz)
Indicates whether the given class is supported by this converter.
|
protected void |
writeToResult(T t,
HttpHeaders headers,
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(Class<?> clazz)
AbstractHttpMessageConverter
supports
in class AbstractHttpMessageConverter<T extends Source>
clazz
- the class to test for supporttrue
if supported; false
otherwiseprotected T readFromSource(Class clazz, HttpHeaders headers, Source source) throws IOException
AbstractXmlHttpMessageConverter
AbstractHttpMessageConverter.read(Class, HttpInputMessage)
.readFromSource
in class AbstractXmlHttpMessageConverter<T extends Source>
clazz
- the type of object to returnheaders
- the HTTP input headerssource
- the HTTP input bodyIOException
- in case of I/O errorsprotected 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 Source>
t
- the type to return the content length fornull
if not knownprotected void writeToResult(T t, HttpHeaders headers, Result result) throws IOException
AbstractXmlHttpMessageConverter
AbstractXmlHttpMessageConverter.writeInternal(Object, HttpOutputMessage)
.writeToResult
in class AbstractXmlHttpMessageConverter<T extends Source>
t
- the object to write to the output messageheaders
- the HTTP output headersresult
- the HTTP output bodyIOException
- in case of I/O errors