Class AbstractJackson2Decoder

java.lang.Object
org.springframework.http.codec.json.Jackson2CodecSupport
org.springframework.http.codec.json.AbstractJackson2Decoder
All Implemented Interfaces:
org.springframework.core.codec.Decoder<Object>, HttpMessageDecoder<Object>
Direct Known Subclasses:
Jackson2CborDecoder, Jackson2JsonDecoder, Jackson2SmileDecoder

@Deprecated(since="7.0", forRemoval=true) public abstract class AbstractJackson2Decoder extends Jackson2CodecSupport implements HttpMessageDecoder<Object>
Deprecated, for removal: This API element is subject to removal in a future version.
since 7.0 in favor of AbstractJacksonDecoder
Abstract base class for Jackson 2.x decoding, leveraging non-blocking parsing.
Since:
5.0
Author:
Sebastien Deleuze, Rossen Stoyanchev, Arjen Poutsma
See Also:
  • Field Summary

    Fields inherited from class org.springframework.http.codec.json.Jackson2CodecSupport

    JSON_VIEW_HINT, logger
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractJackson2Decoder(com.fasterxml.jackson.databind.ObjectMapper mapper, org.springframework.util.MimeType... mimeTypes)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Constructor with a Jackson ObjectMapper to use.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canDecode(org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected com.fasterxml.jackson.databind.ObjectReader
    customizeReader(com.fasterxml.jackson.databind.ObjectReader reader, org.springframework.core.ResolvableType elementType, @Nullable Map<String,Object> hints)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Subclasses can use this method to customize ObjectReader used for reading values.
    reactor.core.publisher.Flux<Object>
    decode(Publisher<org.springframework.core.io.buffer.DataBuffer> input, org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    decode(org.springframework.core.io.buffer.DataBuffer dataBuffer, org.springframework.core.ResolvableType targetType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    reactor.core.publisher.Mono<Object>
    decodeToMono(Publisher<org.springframework.core.io.buffer.DataBuffer> input, org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected <A extends Annotation>
    @Nullable A
    getAnnotation(org.springframework.core.MethodParameter parameter, Class<A> annotType)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    List<org.springframework.util.MimeType>
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    List<org.springframework.util.MimeType>
    getDecodableMimeTypes(org.springframework.core.ResolvableType targetType)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    getDecodeHints(org.springframework.core.ResolvableType actualType, org.springframework.core.ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Get decoding hints based on the server request or annotations on the target controller method parameter.
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
    Return the configured byte count limit.
    protected reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer>
    processInput(Publisher<org.springframework.core.io.buffer.DataBuffer> input, org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Process the input publisher into a flux.
    void
    setMaxInMemorySize(int byteCount)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set the max number of bytes that can be buffered by this decoder.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractJackson2Decoder

      protected AbstractJackson2Decoder(com.fasterxml.jackson.databind.ObjectMapper mapper, org.springframework.util.MimeType... mimeTypes)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constructor with a Jackson ObjectMapper to use.
  • Method Details

    • setMaxInMemorySize

      public void setMaxInMemorySize(int byteCount)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the max number of bytes that can be buffered by this decoder. This is either the size of the entire input when decoding as a whole, or the size of one top-level JSON object within a JSON stream. When the limit is exceeded, DataBufferLimitException is raised.

      By default this is set to 256K.

      Parameters:
      byteCount - the max number of bytes to buffer, or -1 for unlimited
      Since:
      5.1.11
    • getMaxInMemorySize

      public int getMaxInMemorySize()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Return the configured byte count limit.
      Since:
      5.1.11
    • canDecode

      public boolean canDecode(org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      canDecode in interface org.springframework.core.codec.Decoder<Object>
    • decode

      public reactor.core.publisher.Flux<Object> decode(Publisher<org.springframework.core.io.buffer.DataBuffer> input, org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      decode in interface org.springframework.core.codec.Decoder<Object>
    • processInput

      protected reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer> processInput(Publisher<org.springframework.core.io.buffer.DataBuffer> input, org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Process the input publisher into a flux. Default implementation returns Flux.from(Publisher), but subclasses can choose to customize this behavior.
      Parameters:
      input - the DataBuffer input stream to process
      elementType - the expected type of elements in the output stream
      mimeType - the MIME type associated with the input stream (optional)
      hints - additional information about how to do encode
      Returns:
      the processed flux
      Since:
      5.1.14
    • decodeToMono

      public reactor.core.publisher.Mono<Object> decodeToMono(Publisher<org.springframework.core.io.buffer.DataBuffer> input, org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      decodeToMono in interface org.springframework.core.codec.Decoder<Object>
    • decode

      public Object decode(org.springframework.core.io.buffer.DataBuffer dataBuffer, org.springframework.core.ResolvableType targetType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints) throws org.springframework.core.codec.DecodingException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      decode in interface org.springframework.core.codec.Decoder<Object>
      Throws:
      org.springframework.core.codec.DecodingException
    • customizeReader

      protected com.fasterxml.jackson.databind.ObjectReader customizeReader(com.fasterxml.jackson.databind.ObjectReader reader, org.springframework.core.ResolvableType elementType, @Nullable Map<String,Object> hints)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Subclasses can use this method to customize ObjectReader used for reading values.
      Parameters:
      reader - the reader instance to customize
      elementType - the target type of element values to read to
      hints - a map with serialization hints; the Reactor Context, when available, may be accessed under the key ContextView.class.getName()
      Returns:
      the customized ObjectReader to use
      Since:
      6.0
    • getDecodeHints

      public Map<String,Object> getDecodeHints(org.springframework.core.ResolvableType actualType, org.springframework.core.ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: HttpMessageDecoder
      Get decoding hints based on the server request or annotations on the target controller method parameter.
      Specified by:
      getDecodeHints in interface HttpMessageDecoder<Object>
      Parameters:
      actualType - the actual target type to decode to, possibly a reactive wrapper and sourced from MethodParameter, i.e. providing access to method parameter annotations
      elementType - the element type within Flux/Mono that we're trying to decode to
      request - the current request
      response - the current response
      Returns:
      a Map with hints, possibly empty
    • getDecodableMimeTypes

      public List<org.springframework.util.MimeType> getDecodableMimeTypes()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getDecodableMimeTypes in interface org.springframework.core.codec.Decoder<Object>
    • getDecodableMimeTypes

      public List<org.springframework.util.MimeType> getDecodableMimeTypes(org.springframework.core.ResolvableType targetType)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getDecodableMimeTypes in interface org.springframework.core.codec.Decoder<Object>
    • getAnnotation

      protected <A extends Annotation> @Nullable A getAnnotation(org.springframework.core.MethodParameter parameter, Class<A> annotType)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getAnnotation in class Jackson2CodecSupport