Class JacksonXmlHttpMessageConverter
java.lang.Object
org.springframework.http.converter.AbstractHttpMessageConverter<Object>
org.springframework.http.converter.AbstractSmartHttpMessageConverter<Object>
org.springframework.http.converter.AbstractJacksonHttpMessageConverter
org.springframework.http.converter.xml.JacksonXmlHttpMessageConverter
- All Implemented Interfaces:
HttpMessageConverter<Object>
,SmartHttpMessageConverter<Object>
Implementation of
HttpMessageConverter
that can read and write XML using
Jackson 3.x extension component for reading and writing XML encoded data.
By default, this converter supports application/xml
, text/xml
, and
application/*+xml
with UTF-8
character set. This can be overridden by
setting the supportedMediaTypes
property.
The default constructor loads JacksonModule
s
found by MapperBuilder.findModules(ClassLoader)
.
The following hint entries are supported:
- A JSON view with a
com.fasterxml.jackson.annotation.JsonView
key and the class name of the JSON view as value. - A filter provider with a
tools.jackson.databind.ser.FilterProvider
key and the filter provider class name as value.
- Since:
- 7.0
- Author:
- Sebastien Deleuze
-
Field Summary
Fields inherited from class org.springframework.http.converter.AbstractJacksonHttpMessageConverter
defaultObjectMapper
Fields inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
logger
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new instance with anXmlMapper
created fromdefensiveXmlFactory()
and customized with theJacksonModule
s found byMapperBuilder.findModules(ClassLoader)
andProblemDetailJacksonXmlMixin
.JacksonXmlHttpMessageConverter
(tools.jackson.dataformat.xml.XmlMapper xmlMapper) Construct a new instance with the providedXmlMapper
.JacksonXmlHttpMessageConverter
(tools.jackson.dataformat.xml.XmlMapper.Builder builder) Construct a new instance with the providedbuilder
customized with theJacksonModule
s found byMapperBuilder.findModules(ClassLoader)
andProblemDetailJacksonXmlMixin
. -
Method Summary
Modifier and TypeMethodDescriptionstatic tools.jackson.dataformat.xml.XmlFactory
Return anXmlFactory
created fromStaxUtils.createDefensiveInputFactory()
with Spring's defensive setup, i.e.Return the supported media type(s) forProblemDetail
.Methods inherited from class org.springframework.http.converter.AbstractJacksonHttpMessageConverter
canRead, canWrite, customizeReader, customizeWriter, getCharset, getJavaType, getJsonEncoding, getObjectMapper, getObjectMappersForType, getSupportedMediaTypes, read, readInternal, registerObjectMappersForType, setSupportedMediaTypes, supportsRepeatableWrites, writeInternal, writePrefix, writeSuffix
Methods inherited from class org.springframework.http.converter.AbstractSmartHttpMessageConverter
canWrite, supports, write, writeInternal
Methods inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
addDefaultHeaders, canRead, canRead, canWrite, getContentLength, getDefaultCharset, getDefaultContentType, getSupportedMediaTypes, read, setDefaultCharset, write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.http.converter.HttpMessageConverter
getSupportedMediaTypes
Methods inherited from interface org.springframework.http.converter.SmartHttpMessageConverter
canRead, read, write
-
Constructor Details
-
JacksonXmlHttpMessageConverter
public JacksonXmlHttpMessageConverter()Construct a new instance with anXmlMapper
created fromdefensiveXmlFactory()
and customized with theJacksonModule
s found byMapperBuilder.findModules(ClassLoader)
andProblemDetailJacksonXmlMixin
. -
JacksonXmlHttpMessageConverter
public JacksonXmlHttpMessageConverter(tools.jackson.dataformat.xml.XmlMapper.Builder builder) Construct a new instance with the providedbuilder
customized with theJacksonModule
s found byMapperBuilder.findModules(ClassLoader)
andProblemDetailJacksonXmlMixin
. -
JacksonXmlHttpMessageConverter
public JacksonXmlHttpMessageConverter(tools.jackson.dataformat.xml.XmlMapper xmlMapper) Construct a new instance with the providedXmlMapper
.- See Also:
-
-
Method Details
-
defensiveXmlFactory
public static tools.jackson.dataformat.xml.XmlFactory defensiveXmlFactory()Return anXmlFactory
created fromStaxUtils.createDefensiveInputFactory()
with Spring's defensive setup, i.e. no support for the resolution of DTDs and external entities. -
getMediaTypesForProblemDetail
Description copied from class:AbstractJacksonHttpMessageConverter
Return the supported media type(s) forProblemDetail
. By default, an empty list, unless overridden in subclasses.- Overrides:
getMediaTypesForProblemDetail
in classAbstractJacksonHttpMessageConverter
-