类 DecoderHttpMessageReader<T>

java.lang.Object
cn.taketoday.http.codec.DecoderHttpMessageReader<T>
类型参数:
T - the type of objects in the decoded output stream
所有已实现的接口:
HttpMessageReader<T>
直接已知子类:
ResourceHttpMessageReader

public class DecoderHttpMessageReader<T> extends Object implements HttpMessageReader<T>
HttpMessageReader that wraps and delegates to a Decoder.

Also a HttpMessageReader that pre-resolves decoding hints from the extra information available on the server side such as the request or controller method parameter annotations.

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

    • decoder

      private final cn.taketoday.core.codec.Decoder<T> decoder
    • mediaTypes

      private final List<MediaType> mediaTypes
  • 构造器详细资料

    • DecoderHttpMessageReader

      public DecoderHttpMessageReader(cn.taketoday.core.codec.Decoder<T> decoder)
      Create an instance wrapping the given Decoder.
  • 方法详细资料

    • initLogger

      private static void initLogger(cn.taketoday.core.codec.Decoder<?> decoder)
    • getDecoder

      public cn.taketoday.core.codec.Decoder<T> getDecoder()
      Return the Decoder of this reader.
    • getReadableMediaTypes

      public List<MediaType> getReadableMediaTypes()
      从接口复制的说明: HttpMessageReader
      Return the list of media types supported by this reader. The list may not apply to every possible target element type and calls to this method should typically be guarded via canWrite(elementType, null). The list may also exclude media types supported only for a specific element type. Alternatively, use HttpMessageReader.getReadableMediaTypes(ResolvableType) for a more precise list.
      指定者:
      getReadableMediaTypes 在接口中 HttpMessageReader<T>
      返回:
      the general list of supported media types
    • getReadableMediaTypes

      public List<MediaType> getReadableMediaTypes(cn.taketoday.core.ResolvableType elementType)
      从接口复制的说明: HttpMessageReader
      Return the list of media types supported by this Reader for the given type of element. This list may differ from HttpMessageReader.getReadableMediaTypes() if the Reader doesn't support the element type, or if it supports it only for a subset of media types.
      指定者:
      getReadableMediaTypes 在接口中 HttpMessageReader<T>
      参数:
      elementType - the type of element to read
      返回:
      the list of media types supported for the given class
    • canRead

      public boolean canRead(cn.taketoday.core.ResolvableType elementType, @Nullable MediaType mediaType)
      从接口复制的说明: HttpMessageReader
      Whether the given object type is supported by this reader.
      指定者:
      canRead 在接口中 HttpMessageReader<T>
      参数:
      elementType - the type of object to check
      mediaType - the media type for the read (possibly null)
      返回:
      true if readable, false otherwise
    • read

      public reactor.core.publisher.Flux<T> read(cn.taketoday.core.ResolvableType elementType, ReactiveHttpInputMessage message, Map<String,Object> hints)
      从接口复制的说明: HttpMessageReader
      Read from the input message and decode to a stream of objects.
      指定者:
      read 在接口中 HttpMessageReader<T>
      参数:
      elementType - the type of objects in the stream which must have been previously checked via HttpMessageReader.canRead(ResolvableType, MediaType)
      message - the message to read from
      hints - additional information about how to read and decode the input
      返回:
      the decoded stream of elements
    • readMono

      public reactor.core.publisher.Mono<T> readMono(cn.taketoday.core.ResolvableType elementType, ReactiveHttpInputMessage message, Map<String,Object> hints)
      从接口复制的说明: HttpMessageReader
      Read from the input message and decode to a single object.
      指定者:
      readMono 在接口中 HttpMessageReader<T>
      参数:
      elementType - the type of objects in the stream which must have been previously checked via HttpMessageReader.canRead(ResolvableType, MediaType)
      message - the message to read from
      hints - additional information about how to read and decode the input
      返回:
      the decoded object
    • getContentType

      @Nullable protected MediaType getContentType(HttpMessage inputMessage)
      Determine the Content-Type of the HTTP message based on the "Content-Type" header or otherwise default to MediaType.APPLICATION_OCTET_STREAM.
      参数:
      inputMessage - the HTTP message
      返回:
      the MediaType, possibly null.
    • getReadHints

      protected Map<String,Object> getReadHints(cn.taketoday.core.ResolvableType elementType, ReactiveHttpInputMessage message)
      Get additional hints for decoding based on the input HTTP message.
    • read

      public reactor.core.publisher.Flux<T> read(cn.taketoday.core.ResolvableType actualType, cn.taketoday.core.ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response, Map<String,Object> hints)
      从接口复制的说明: HttpMessageReader
      Server-side only alternative to HttpMessageReader.read(ResolvableType, ReactiveHttpInputMessage, Map) with additional context available.
      指定者:
      read 在接口中 HttpMessageReader<T>
      参数:
      actualType - the actual type of the target method parameter; for annotated controllers, the ResolvableMethodParameter can be accessed via ResolvableType.getSource().
      elementType - the type of Objects in the output stream
      request - the current request
      response - the current response
      hints - additional information about how to read the body
      返回:
      the decoded stream of elements
    • readMono

      public reactor.core.publisher.Mono<T> readMono(cn.taketoday.core.ResolvableType actualType, cn.taketoday.core.ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response, Map<String,Object> hints)
      从接口复制的说明: HttpMessageReader
      Server-side only alternative to HttpMessageReader.readMono(ResolvableType, ReactiveHttpInputMessage, Map) with additional, context available.
      指定者:
      readMono 在接口中 HttpMessageReader<T>
      参数:
      actualType - the actual type of the target method parameter; for annotated controllers, the ResolvableMethodParameter can be accessed via ResolvableType.getSource().
      elementType - the type of Objects in the output stream
      request - the current request
      response - the current response
      hints - additional information about how to read the body
      返回:
      the decoded stream of elements
    • getReadHints

      protected Map<String,Object> getReadHints(cn.taketoday.core.ResolvableType actualType, cn.taketoday.core.ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response)
      Get additional hints for decoding for example based on the server request or annotations from controller method parameters. By default, delegate to the decoder if it is an instance of HttpMessageDecoder.