|
Spring for Android | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.http.converter.AbstractHttpMessageConverter<T>
org.springframework.http.converter.xml.SourceHttpMessageConverter<T>
public class SourceHttpMessageConverter<T extends javax.xml.transform.Source>
Implementation of HttpMessageConverter
that can read and write Source
objects.
Constructor Summary | |
---|---|
SourceHttpMessageConverter()
Sets the supportedMediaTypes
to text/xml and application/xml , and application/*-xml . |
Method Summary | |
---|---|
protected java.lang.Long |
getContentLength(T t,
MediaType contentType)
Returns the content length for the given type. |
boolean |
isProcessExternalEntities()
Returns the configured value for whether XML external entities are allowed. |
protected T |
readInternal(java.lang.Class<? extends T> clazz,
HttpInputMessage inputMessage)
Abstract template method that reads the actual object. |
void |
setProcessExternalEntities(boolean processExternalEntities)
Indicates whether external XML entities are processed when converting to a Source. |
boolean |
supports(java.lang.Class<?> clazz)
Indicates whether the given class is supported by this converter. |
protected void |
writeInternal(T t,
HttpOutputMessage outputMessage)
Abstract template method that writes the actual body. |
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 |
---|
public SourceHttpMessageConverter()
supportedMediaTypes
to text/xml
and application/xml
, and application/*-xml
.
Method Detail |
---|
public void setProcessExternalEntities(boolean processExternalEntities)
Default is false
, meaning that external entities are not resolved.
Note: This feature is not supported when reading DOMSource
entities and is only supported on Android 4.0 and newer when reading
SAXSource
.
public boolean isProcessExternalEntities()
public boolean supports(java.lang.Class<?> clazz)
AbstractHttpMessageConverter
supports
in class AbstractHttpMessageConverter<T extends javax.xml.transform.Source>
clazz
- the class to test for support
true
if supported; false
otherwiseprotected T readInternal(java.lang.Class<? extends T> clazz, HttpInputMessage inputMessage) throws java.io.IOException, HttpMessageNotReadableException
AbstractHttpMessageConverter
AbstractHttpMessageConverter.read(java.lang.Class extends T>, org.springframework.http.HttpInputMessage)
.
readInternal
in class AbstractHttpMessageConverter<T extends javax.xml.transform.Source>
clazz
- the type of object to returninputMessage
- the HTTP input message to read from
java.io.IOException
- in case of I/O errors
HttpMessageNotReadableException
- in case of conversion errorsprotected java.lang.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 javax.xml.transform.Source>
t
- the type to return the content length for
null
if not knownprotected void writeInternal(T t, HttpOutputMessage outputMessage) throws java.io.IOException, HttpMessageNotWritableException
AbstractHttpMessageConverter
AbstractHttpMessageConverter.write(T, org.springframework.http.MediaType, org.springframework.http.HttpOutputMessage)
.
writeInternal
in class AbstractHttpMessageConverter<T extends javax.xml.transform.Source>
t
- the object to write to the output messageoutputMessage
- the HTTP output message to write to
java.io.IOException
- in case of I/O errors
HttpMessageNotWritableException
- in case of conversion errors
|
Spring for Android | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |