spring-framework / org.springframework.http.converter.xml / Jaxb2RootElementHttpMessageConverter

Jaxb2RootElementHttpMessageConverter

open class Jaxb2RootElementHttpMessageConverter : AbstractJaxb2HttpMessageConverter<Any>

Implementation of org.springframework.http.converter.HttpMessageConverter that can read and write XML using JAXB2.

This converter can read classes annotated with XmlRootElement and XmlType, and write classes annotated with XmlRootElement, or subclasses thereof.

Note: When using Spring's Marshaller/Unmarshaller abstractions from spring-oxm, you should use the MarshallingHttpMessageConverter instead.

Author
Arjen Poutsma

Author
Sebastien Deleuze

Author
Rossen Stoyanchev

Since
3.0

See Also
MarshallingHttpMessageConverter

Constructors

<init>

Jaxb2RootElementHttpMessageConverter()

Implementation of org.springframework.http.converter.HttpMessageConverter that can read and write XML using JAXB2.

This converter can read classes annotated with XmlRootElement and XmlType, and write classes annotated with XmlRootElement, or subclasses thereof.

Note: When using Spring's Marshaller/Unmarshaller abstractions from spring-oxm, you should use the MarshallingHttpMessageConverter instead.

Functions

canRead

open fun canRead(clazz: Class<*>, mediaType: MediaType): Boolean

canWrite

open fun canWrite(clazz: Class<*>, mediaType: MediaType): Boolean

isProcessExternalEntities

open fun isProcessExternalEntities(): Boolean

Returns the configured value for whether XML external entities are allowed.

isSupportDtd

open fun isSupportDtd(): Boolean

Whether DTD parsing is supported.

setProcessExternalEntities

open fun setProcessExternalEntities(processExternalEntities: Boolean): Unit

Indicates whether external XML entities are processed when converting to a Source.

Default is false, meaning that external entities are not resolved.

Note: setting this option to true also automatically sets #setSupportDtd to true.

setSupportDtd

open fun setSupportDtd(supportDtd: Boolean): Unit

Indicates whether DTD parsing should be supported.

Default is false meaning that DTD is disabled.