org.springframework.http.converter.xml
Class SourceHttpMessageConverter<T extends Source>

java.lang.Object
  extended by org.springframework.http.converter.AbstractHttpMessageConverter<T>
      extended by org.springframework.http.converter.xml.AbstractXmlHttpMessageConverter<T>
          extended by 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

Field Summary
 
Fields inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
logger
 
Constructor Summary
SourceHttpMessageConverter()
           
 
Method Summary
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).
 
Methods inherited from class org.springframework.http.converter.xml.AbstractXmlHttpMessageConverter
readInternal, transform, writeInternal
 
Methods inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
canRead, canRead, canWrite, canWrite, getContentLength, getDefaultContentType, getSupportedMediaTypes, read, setSupportedMediaTypes, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceHttpMessageConverter

public SourceHttpMessageConverter()
Method Detail

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 return
headers - the HTTP input headers
source - the HTTP input body
Returns:
the converted object
Throws:
IOException - in case of I/O errors

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 message
headers - the HTTP output headers
result - the HTTP output body
Throws:
IOException - in case of I/O errors