org.springframework.http.converter.xml
Class SourceHttpMessageConverter<T extends Source>
java.lang.Object
org.springframework.http.converter.AbstractHttpMessageConverter<T>
org.springframework.http.converter.xml.AbstractXmlHttpMessageConverter<T>
org.springframework.http.converter.xml.SourceHttpMessageConverter<T>
- All Implemented Interfaces:
- HttpMessageConverter<T>
public class SourceHttpMessageConverter<T extends Source>
- extends AbstractXmlHttpMessageConverter<T>
Implementation of HttpMessageConverter that can read and write Source objects.
- Since:
- 3.0
- Author:
- Arjen Poutsma
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SourceHttpMessageConverter
public SourceHttpMessageConverter()
supports
public boolean supports(Class<?> clazz)
- Description copied from class:
AbstractHttpMessageConverter
- Indicates whether the given class is supported by this converter.
- Specified by:
supports in class AbstractHttpMessageConverter<T extends Source>
- Parameters:
clazz - the class to test for support
- Returns:
true if supported; false otherwise
readFromSource
protected T readFromSource(Class clazz,
HttpHeaders headers,
Source source)
throws IOException
- Description copied from class:
AbstractXmlHttpMessageConverter
- Abstract template method called from
AbstractHttpMessageConverter.read(Class, HttpInputMessage).
- Specified by:
readFromSource in class AbstractXmlHttpMessageConverter<T extends Source>
- Parameters:
clazz - the type of object to returnheaders - the HTTP input headerssource - the HTTP input body
- Returns:
- the converted object
- Throws:
IOException - in case of I/O errors
getContentLength
protected Long getContentLength(T t,
MediaType contentType)
- Description copied from class:
AbstractHttpMessageConverter
- Returns the content length for the given type.
By default, this returns null, meaning that the content length is unknown.
Can be overridden in subclasses.
- Overrides:
getContentLength in class AbstractHttpMessageConverter<T extends Source>
- Parameters:
t - the type to return the content length for
- Returns:
- the content length, or
null if not known
writeToResult
protected void writeToResult(T t,
HttpHeaders headers,
Result result)
throws IOException
- Description copied from class:
AbstractXmlHttpMessageConverter
- Abstract template method called from
AbstractXmlHttpMessageConverter.writeInternal(Object, HttpOutputMessage).
- Specified by:
writeToResult in class AbstractXmlHttpMessageConverter<T extends Source>
- Parameters:
t - the object to write to the output messageheaders - the HTTP output headersresult - the HTTP output body
- Throws:
IOException - in case of I/O errors