类 AbstractJackson2Decoder

java.lang.Object
cn.taketoday.http.codec.json.Jackson2CodecSupport
cn.taketoday.http.codec.json.AbstractJackson2Decoder
所有已实现的接口:
cn.taketoday.core.codec.Decoder<Object>, HttpMessageDecoder<Object>
直接已知子类:
Jackson2CborDecoder, Jackson2JsonDecoder, Jackson2SmileDecoder

public abstract class AbstractJackson2Decoder extends Jackson2CodecSupport implements HttpMessageDecoder<Object>
Abstract base class for Jackson 2.9 decoding, leveraging non-blocking parsing.

Compatible with Jackson 2.9.7 and higher.

从以下版本开始:
4.0
作者:
Sebastien Deleuze, Rossen Stoyanchev, Arjen Poutsma, Harry Yang
另请参阅:
  • 字段详细资料

    • maxInMemorySize

      private int maxInMemorySize
  • 构造器详细资料

    • AbstractJackson2Decoder

      protected AbstractJackson2Decoder(ObjectMapper mapper, cn.taketoday.util.MimeType... mimeTypes)
      Constructor with a Jackson ObjectMapper to use.
  • 方法详细资料

    • setMaxInMemorySize

      public void setMaxInMemorySize(int byteCount)
      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.

      参数:
      byteCount - the max number of bytes to buffer, or -1 for unlimited
    • getMaxInMemorySize

      public int getMaxInMemorySize()
      Return the configured byte count limit.
    • canDecode

      public boolean canDecode(cn.taketoday.core.ResolvableType elementType, @Nullable cn.taketoday.util.MimeType mimeType)
      指定者:
      canDecode 在接口中 cn.taketoday.core.codec.Decoder<Object>
    • decode

      public reactor.core.publisher.Flux<Object> decode(org.reactivestreams.Publisher<cn.taketoday.core.io.buffer.DataBuffer> input, cn.taketoday.core.ResolvableType elementType, @Nullable cn.taketoday.util.MimeType mimeType, @Nullable Map<String,Object> hints)
      指定者:
      decode 在接口中 cn.taketoday.core.codec.Decoder<Object>
    • processInput

      protected reactor.core.publisher.Flux<cn.taketoday.core.io.buffer.DataBuffer> processInput(org.reactivestreams.Publisher<cn.taketoday.core.io.buffer.DataBuffer> input, cn.taketoday.core.ResolvableType elementType, @Nullable cn.taketoday.util.MimeType mimeType, @Nullable Map<String,Object> hints)
      Process the input publisher into a flux. Default implementation returns Flux.from(Publisher), but subclasses can choose to customize this behavior.
      参数:
      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
      返回:
      the processed flux
    • decodeToMono

      public reactor.core.publisher.Mono<Object> decodeToMono(org.reactivestreams.Publisher<cn.taketoday.core.io.buffer.DataBuffer> input, cn.taketoday.core.ResolvableType elementType, @Nullable cn.taketoday.util.MimeType mimeType, @Nullable Map<String,Object> hints)
      指定者:
      decodeToMono 在接口中 cn.taketoday.core.codec.Decoder<Object>
    • decode

      public Object decode(cn.taketoday.core.io.buffer.DataBuffer dataBuffer, cn.taketoday.core.ResolvableType targetType, @Nullable cn.taketoday.util.MimeType mimeType, @Nullable Map<String,Object> hints) throws cn.taketoday.core.codec.DecodingException
      指定者:
      decode 在接口中 cn.taketoday.core.codec.Decoder<Object>
      抛出:
      cn.taketoday.core.codec.DecodingException
    • createObjectReader

      private ObjectReader createObjectReader(ObjectMapper mapper, cn.taketoday.core.ResolvableType elementType, @Nullable Map<String,Object> hints)
    • customizeReader

      protected ObjectReader customizeReader(ObjectReader reader, cn.taketoday.core.ResolvableType elementType, @Nullable Map<String,Object> hints)
      Subclasses can use this method to customize ObjectReader used for reading values.
      参数:
      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()
      返回:
      the customized ObjectReader to use
    • getContextClass

      @Nullable private Class<?> getContextClass(@Nullable cn.taketoday.core.ResolvableType elementType)
    • logValue

      private void logValue(@Nullable Object value, @Nullable Map<String,Object> hints)
    • processException

      private cn.taketoday.core.codec.CodecException processException(IOException ex)
    • getDecodeHints

      public Map<String,Object> getDecodeHints(cn.taketoday.core.ResolvableType actualType, cn.taketoday.core.ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response)
      从接口复制的说明: HttpMessageDecoder
      Get decoding hints based on the server request or annotations on the target controller method parameter.
      指定者:
      getDecodeHints 在接口中 HttpMessageDecoder<Object>
      参数:
      actualType - the actual target type to decode to, possibly a reactive wrapper and sourced from Parameter, 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
      返回:
      a Map with hints, possibly empty
    • getDecodableMimeTypes

      public List<cn.taketoday.util.MimeType> getDecodableMimeTypes()
      指定者:
      getDecodableMimeTypes 在接口中 cn.taketoday.core.codec.Decoder<Object>
    • getDecodableMimeTypes

      public List<cn.taketoday.util.MimeType> getDecodableMimeTypes(cn.taketoday.core.ResolvableType targetType)
      指定者:
      getDecodableMimeTypes 在接口中 cn.taketoday.core.codec.Decoder<Object>
    • getAnnotation

      protected <A extends Annotation> A getAnnotation(cn.taketoday.core.MethodParameter parameter, Class<A> annotType)
      指定者:
      getAnnotation 在类中 Jackson2CodecSupport