接口 HttpMessageReader<T>

类型参数:
T - the type of objects in the decoded output stream
所有已知实现类:
DecoderHttpMessageReader, DefaultPartHttpMessageReader, FormHttpMessageReader, MultipartHttpMessageReader, PartEventHttpMessageReader, ResourceHttpMessageReader, ServerSentEventHttpMessageReader

public interface HttpMessageReader<T>
Strategy for reading from a ReactiveHttpInputMessage and decoding the stream of bytes to Objects of type <T>.
从以下版本开始:
4.0
作者:
Rossen Stoyanchev, Arjen Poutsma, Sebastien Deleuze
  • 方法详细资料

    • getReadableMediaTypes

      List<MediaType> getReadableMediaTypes()
      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 getReadableMediaTypes(ResolvableType) for a more precise list.
      返回:
      the general list of supported media types
    • getReadableMediaTypes

      default List<MediaType> getReadableMediaTypes(cn.taketoday.core.ResolvableType elementType)
      Return the list of media types supported by this Reader for the given type of element. This list may differ from getReadableMediaTypes() if the Reader doesn't support the element type, or if it supports it only for a subset of media types.
      参数:
      elementType - the type of element to read
      返回:
      the list of media types supported for the given class
    • canRead

      boolean canRead(cn.taketoday.core.ResolvableType elementType, @Nullable MediaType mediaType)
      Whether the given object type is supported by this reader.
      参数:
      elementType - the type of object to check
      mediaType - the media type for the read (possibly null)
      返回:
      true if readable, false otherwise
    • read

      reactor.core.publisher.Flux<T> read(cn.taketoday.core.ResolvableType elementType, ReactiveHttpInputMessage message, Map<String,Object> hints)
      Read from the input message and decode to a stream of objects.
      参数:
      elementType - the type of objects in the stream which must have been previously checked via 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

      reactor.core.publisher.Mono<T> readMono(cn.taketoday.core.ResolvableType elementType, ReactiveHttpInputMessage message, Map<String,Object> hints)
      Read from the input message and decode to a single object.
      参数:
      elementType - the type of objects in the stream which must have been previously checked via canRead(ResolvableType, MediaType)
      message - the message to read from
      hints - additional information about how to read and decode the input
      返回:
      the decoded object
    • read

      default reactor.core.publisher.Flux<T> read(cn.taketoday.core.ResolvableType actualType, cn.taketoday.core.ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response, Map<String,Object> hints)
      Server-side only alternative to read(ResolvableType, ReactiveHttpInputMessage, Map) with additional context available.
      参数:
      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

      default reactor.core.publisher.Mono<T> readMono(cn.taketoday.core.ResolvableType actualType, cn.taketoday.core.ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response, Map<String,Object> hints)
      Server-side only alternative to readMono(ResolvableType, ReactiveHttpInputMessage, Map) with additional, context available.
      参数:
      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