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:
  • Constructor Details

    • JacksonXmlDecoder

      public JacksonXmlDecoder()
      Construct a new instance with a XmlMapper customized with the JacksonModules found by MapperBuilder.findModules(ClassLoader).
    • JacksonXmlDecoder

      public JacksonXmlDecoder(tools.jackson.dataformat.xml.XmlMapper.Builder builder)
      Construct a new instance with the provided XmlMapper.Builder customized with the JacksonModules found by MapperBuilder.findModules(ClassLoader).
      See Also:
    • JacksonXmlDecoder

      public JacksonXmlDecoder(tools.jackson.dataformat.xml.XmlMapper mapper)
      Construct a new instance with the provided XmlMapper.
      See Also:
    • JacksonXmlDecoder

      public JacksonXmlDecoder(tools.jackson.dataformat.xml.XmlMapper.Builder builder, MimeType... mimeTypes)
      Construct a new instance with the provided XmlMapper.Builder customized with the JacksonModules found by MapperBuilder.findModules(ClassLoader), and MimeTypes.
      See Also:
    • JacksonXmlDecoder

      public JacksonXmlDecoder(tools.jackson.dataformat.xml.XmlMapper mapper, MimeType... mimeTypes)
      Construct a new instance with the provided XmlMapper and MimeTypes.
      See Also:
  • Method Details

    • canDecode

      public boolean canDecode(ResolvableType elementType, @Nullable MimeType mimeType)
      Description copied from interface: Decoder
      Whether the decoder supports the given target element type and the MIME type of the source stream.
      Specified by:
      canDecode in interface Decoder<Object>
      Overrides:
      canDecode in class AbstractJacksonDecoder<tools.jackson.dataformat.xml.XmlMapper>
      Parameters:
      elementType - the target element type for the output stream
      mimeType - the mime type associated with the stream to decode (can be null if not specified)
      Returns:
      true if supported, false otherwise
    • decode

      public Flux<Object> decode(Publisher<DataBuffer> input, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
      Description copied from interface: Decoder
      Decode a DataBuffer input stream into a Flux of T.
      Specified by:
      decode in interface Decoder<Object>
      Overrides:
      decode in class AbstractJacksonDecoder<tools.jackson.dataformat.xml.XmlMapper>
      Parameters:
      input - the DataBuffer input stream to decode
      elementType - the expected type of elements in the output stream; this type must have been previously passed to the Decoder.canDecode(ResolvableType, MimeType) method and it must have returned true.
      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 an XmlFactory created from StaxUtils.createDefensiveInputFactory() with Spring's defensive setup, i.e. no support for the resolution of DTDs and external entities.