public class

SourceHttpMessageConverter

extends AbstractXmlHttpMessageConverter<T>
java.lang.Object
   ↳ org.springframework.http.converter.AbstractHttpMessageConverter<T>
     ↳ org.springframework.http.converter.xml.AbstractXmlHttpMessageConverter<T>
       ↳ org.springframework.http.converter.xml.SourceHttpMessageConverter<T extends javax.xml.transform.Source>

Class Overview

Implementation of HttpMessageConverter that can read and write Source objects.

Summary

[Expand]
Inherited Fields
From class org.springframework.http.converter.AbstractHttpMessageConverter
Public Constructors
SourceHttpMessageConverter()
Public Methods
boolean supports(Class<?> clazz)
Indicates whether the given class is supported by this converter.
Protected Methods
Long getContentLength(T t, MediaType contentType)
Returns the content length for the given type.
T readFromSource(Class clazz, HttpHeaders headers, Source source)
Abstract template method called from read(Class, HttpInputMessage).
void writeToResult(T t, HttpHeaders headers, Result result)
Abstract template method called from writeInternal(Object, HttpOutputMessage).
[Expand]
Inherited Methods
From class org.springframework.http.converter.xml.AbstractXmlHttpMessageConverter
From class org.springframework.http.converter.AbstractHttpMessageConverter
From class java.lang.Object
From interface org.springframework.http.converter.HttpMessageConverter

Public Constructors

public SourceHttpMessageConverter ()

Public Methods

public boolean supports (Class<?> clazz)

Indicates whether the given class is supported by this converter.

Parameters
clazz the class to test for support
Returns
  • true if supported; false otherwise

Protected Methods

protected Long getContentLength (T t, MediaType contentType)

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.

Parameters
t the type to return the content length for
Returns
  • the content length, or null if not known

protected T readFromSource (Class clazz, HttpHeaders headers, Source source)

Abstract template method called from read(Class, HttpInputMessage).

Parameters
clazz the type of object to return
headers the HTTP input headers
source the HTTP input body
Returns
  • the converted object
Throws
IOException

protected void writeToResult (T t, HttpHeaders headers, Result result)

Abstract template method called from writeInternal(Object, HttpOutputMessage).

Parameters
t the object to write to the output message
headers the HTTP output headers
result the HTTP output body
Throws
IOException