Class MappingJackson2XmlHttpMessageConverter
- All Implemented Interfaces:
GenericHttpMessageConverter<Object>,HttpMessageConverter<Object>
HttpMessageConverter
that can read and write XML using
Jackson 2.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 uses the default configuration provided by Jackson2ObjectMapperBuilder.
- Since:
- 4.1
- Author:
- Sebastien Deleuze
-
Field Summary
Fields inherited from class org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
defaultObjectMapperFields inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
logger -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a newMappingJackson2XmlHttpMessageConverterusing default configuration provided byJackson2ObjectMapperBuilder.MappingJackson2XmlHttpMessageConverter(ObjectMapper objectMapper) Construct a newMappingJackson2XmlHttpMessageConverterwith a customObjectMapper(must be aXmlMapperinstance). -
Method Summary
Modifier and TypeMethodDescriptionReturn the supported media type(s) forProblemDetail.voidsetObjectMapper(ObjectMapper objectMapper) Configure the mainObjectMapperto use for Object conversion.Methods inherited from class org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
canRead, canRead, canWrite, customizeReader, customizeWriter, getCharset, getContentLength, getDefaultContentType, getJavaType, getJsonEncoding, getObjectMapper, getObjectMappersForType, getSupportedMediaTypes, logWarningIfNecessary, read, readInternal, registerObjectMappersForType, setPrettyPrint, setSupportedMediaTypes, writeInternal, writePrefix, writeSuffixMethods inherited from class org.springframework.http.converter.AbstractGenericHttpMessageConverter
canWrite, supports, write, writeInternalMethods inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
addDefaultHeaders, canRead, canWrite, getDefaultCharset, getSupportedMediaTypes, read, setDefaultCharset, writeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.http.converter.HttpMessageConverter
getSupportedMediaTypes, read, write
-
Constructor Details
-
MappingJackson2XmlHttpMessageConverter
public MappingJackson2XmlHttpMessageConverter()Construct a newMappingJackson2XmlHttpMessageConverterusing default configuration provided byJackson2ObjectMapperBuilder. -
MappingJackson2XmlHttpMessageConverter
Construct a newMappingJackson2XmlHttpMessageConverterwith a customObjectMapper(must be aXmlMapperinstance). You can useJackson2ObjectMapperBuilderto build it easily.- See Also:
-
-
Method Details
-
setObjectMapper
Configure the mainObjectMapperto use for Object conversion. If not set, a defaultObjectMapperinstance is created.Setting a custom-configured
ObjectMapperis one way to take further control of the JSON serialization process. For example, an extendedSerializerFactorycan be configured that provides custom serializers for specific types. Another option for refining the serialization process is to use Jackson's provided annotations on the types to be serialized, in which case a custom-configured ObjectMapper is unnecessary. TheObjectMapperparameter must be aXmlMapperinstance. -
getMediaTypesForProblemDetail
Description copied from class:AbstractJackson2HttpMessageConverterReturn the supported media type(s) forProblemDetail. By default, an empty list, unless overridden in subclasses.- Overrides:
getMediaTypesForProblemDetailin classAbstractJackson2HttpMessageConverter
-