Spring for Android

org.springframework.http.converter.xml
Class SourceHttpMessageConverter<T extends javax.xml.transform.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 javax.xml.transform.Source>
extends AbstractXmlHttpMessageConverter<T>

Implementation of HttpMessageConverter that can read and write Source objects.

Since:
1.0
Author:
Arjen Poutsma, Roy Clarkson

Constructor Summary
SourceHttpMessageConverter()
           
 
Method Summary
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).
 
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, 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(java.lang.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 javax.xml.transform.Source>
Parameters:
clazz - the class to test for support
Returns:
true if supported; false otherwise

readFromSource

protected T readFromSource(java.lang.Class<? extends T> clazz,
                           HttpHeaders headers,
                           javax.xml.transform.Source source)
                                                       throws java.io.IOException
Description copied from class: AbstractXmlHttpMessageConverter
Abstract template method called from AbstractHttpMessageConverter.read(Class, HttpInputMessage).

Specified by:
readFromSource in class AbstractXmlHttpMessageConverter<T extends javax.xml.transform.Source>
Parameters:
clazz - the type of object to return
headers - the HTTP input headers
source - the HTTP input body
Returns:
the converted object
Throws:
java.io.IOException - in case of I/O errors

getContentLength

protected java.lang.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 javax.xml.transform.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,
                             javax.xml.transform.Result result)
                      throws java.io.IOException
Description copied from class: AbstractXmlHttpMessageConverter
Abstract template method called from AbstractXmlHttpMessageConverter.writeInternal(Object, HttpOutputMessage).

Specified by:
writeToResult in class AbstractXmlHttpMessageConverter<T extends javax.xml.transform.Source>
Parameters:
t - the object to write to the output message
headers - the HTTP output headers
result - the HTTP output body
Throws:
java.io.IOException - in case of I/O errors

Spring for Android