Class JacksonXmlDecoder
java.lang.Object
org.springframework.http.codec.JacksonCodecSupport<tools.jackson.dataformat.xml.XmlMapper>
org.springframework.http.codec.AbstractJacksonDecoder<tools.jackson.dataformat.xml.XmlMapper>
org.springframework.http.codec.xml.JacksonXmlDecoder
- All Implemented Interfaces:
Decoder<Object>, HttpMessageDecoder<Object>
public class JacksonXmlDecoder
extends AbstractJacksonDecoder<tools.jackson.dataformat.xml.XmlMapper>
Decode bytes into XML and convert to Objects with Jackson 3.x.
Stream decoding is currently not supported.
- Since:
- 7.0.3
- Author:
- Sebastien Deleuze
- See Also:
-
Field Summary
Fields inherited from class JacksonCodecSupport
FILTER_PROVIDER_HINT, JSON_VIEW_HINT, logger, mapperRegistrations -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new instance with aXmlMappercustomized with theJacksonModules found byMapperBuilder.findModules(ClassLoader).JacksonXmlDecoder(tools.jackson.dataformat.xml.XmlMapper mapper) Construct a new instance with the providedXmlMapper.JacksonXmlDecoder(tools.jackson.dataformat.xml.XmlMapper.Builder builder) Construct a new instance with the providedXmlMapper.Buildercustomized with theJacksonModules found byMapperBuilder.findModules(ClassLoader).JacksonXmlDecoder(tools.jackson.dataformat.xml.XmlMapper.Builder builder, MimeType... mimeTypes) Construct a new instance with the providedXmlMapper.Buildercustomized with theJacksonModules found byMapperBuilder.findModules(ClassLoader), andMimeTypes.JacksonXmlDecoder(tools.jackson.dataformat.xml.XmlMapper mapper, MimeType... mimeTypes) Construct a new instance with the providedXmlMapperandMimeTypes. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanDecode(ResolvableType elementType, @Nullable MimeType mimeType) Whether the decoder supports the given target element type and the MIME type of the source stream.decode(Publisher<DataBuffer> input, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) Decode aDataBufferinput stream into a Flux ofT.static tools.jackson.dataformat.xml.XmlFactoryReturn anXmlFactorycreated fromStaxUtils.createDefensiveInputFactory()with Spring's defensive setup, i.e.Methods inherited from class AbstractJacksonDecoder
customizeReader, decode, decodeToMono, getAnnotation, getDecodableMimeTypes, getDecodableMimeTypes, getDecodeHints, getMaxInMemorySize, processInput, setMaxInMemorySizeMethods inherited from class JacksonCodecSupport
getHints, getJavaType, getMapper, getMapperRegistrations, getMappersForType, getMediaTypesForProblemDetail, getMimeTypes, getMimeTypes, getParameter, registerMappersForType, selectMapper, supportsMimeType
-
Constructor Details
-
JacksonXmlDecoder
public JacksonXmlDecoder()Construct a new instance with aXmlMappercustomized with theJacksonModules found byMapperBuilder.findModules(ClassLoader). -
JacksonXmlDecoder
public JacksonXmlDecoder(tools.jackson.dataformat.xml.XmlMapper.Builder builder) Construct a new instance with the providedXmlMapper.Buildercustomized with theJacksonModules found byMapperBuilder.findModules(ClassLoader).- See Also:
-
JacksonXmlDecoder
public JacksonXmlDecoder(tools.jackson.dataformat.xml.XmlMapper mapper) Construct a new instance with the providedXmlMapper.- See Also:
-
JacksonXmlDecoder
-
JacksonXmlDecoder
-
-
Method Details
-
canDecode
Description copied from interface:DecoderWhether the decoder supports the given target element type and the MIME type of the source stream.- Specified by:
canDecodein interfaceDecoder<Object>- Overrides:
canDecodein classAbstractJacksonDecoder<tools.jackson.dataformat.xml.XmlMapper>- Parameters:
elementType- the target element type for the output streammimeType- the mime type associated with the stream to decode (can benullif not specified)- Returns:
trueif supported,falseotherwise
-
decode
public Flux<Object> decode(Publisher<DataBuffer> input, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) Description copied from interface:DecoderDecode aDataBufferinput stream into a Flux ofT.- Specified by:
decodein interfaceDecoder<Object>- Overrides:
decodein classAbstractJacksonDecoder<tools.jackson.dataformat.xml.XmlMapper>- Parameters:
input- theDataBufferinput stream to decodeelementType- the expected type of elements in the output stream; this type must have been previously passed to theDecoder.canDecode(ResolvableType, MimeType)method and it must have returnedtrue.mimeType- the MIME type associated with the input stream (optional)hints- additional information about how to do decode- Returns:
- the output stream with decoded elements
-
defensiveXmlFactory
public static tools.jackson.dataformat.xml.XmlFactory defensiveXmlFactory()Return anXmlFactorycreated fromStaxUtils.createDefensiveInputFactory()with Spring's defensive setup, i.e. no support for the resolution of DTDs and external entities.
-