Class AbstractMessageWriterResultHandler

java.lang.Object
org.springframework.web.reactive.result.HandlerResultHandlerSupport
org.springframework.web.reactive.result.method.annotation.AbstractMessageWriterResultHandler
All Implemented Interfaces:
org.springframework.core.Ordered
Direct Known Subclasses:
ResponseBodyResultHandler, ResponseEntityResultHandler

public abstract class AbstractMessageWriterResultHandler extends HandlerResultHandlerSupport
Abstract base class for result handlers that handle return values by writing to the response with HttpMessageWriter.
Since:
5.0
Author:
Rossen Stoyanchev, Sebastien Deleuze
  • Field Details

  • Constructor Details

    • AbstractMessageWriterResultHandler

      protected AbstractMessageWriterResultHandler(List<org.springframework.http.codec.HttpMessageWriter<?>> messageWriters, RequestedContentTypeResolver contentTypeResolver)
      Constructor with HttpMessageWriters and a RequestedContentTypeResolver.
      Parameters:
      messageWriters - for serializing Objects to the response body stream
      contentTypeResolver - for resolving the requested content type
    • AbstractMessageWriterResultHandler

      protected AbstractMessageWriterResultHandler(List<org.springframework.http.codec.HttpMessageWriter<?>> messageWriters, RequestedContentTypeResolver contentTypeResolver, org.springframework.core.ReactiveAdapterRegistry adapterRegistry)
      Constructor with an additional ReactiveAdapterRegistry.
      Parameters:
      messageWriters - for serializing Objects to the response body stream
      contentTypeResolver - for resolving the requested content type
      adapterRegistry - for adapting other reactive types (e.g. rx.Observable, rx.Single, etc.) to Flux or Mono
  • Method Details

    • getMessageWriters

      public List<org.springframework.http.codec.HttpMessageWriter<?>> getMessageWriters()
      Return the configured message converters.
    • writeBody

      protected reactor.core.publisher.Mono<Void> writeBody(@Nullable Object body, org.springframework.core.MethodParameter bodyParameter, org.springframework.web.server.ServerWebExchange exchange)
      Write a given body to the response with HttpMessageWriter.
      Parameters:
      body - the object to write
      bodyParameter - the MethodParameter of the body to write
      exchange - the current exchange
      Returns:
      indicates completion or error
      See Also:
    • writeBody

      protected reactor.core.publisher.Mono<Void> writeBody(@Nullable Object body, org.springframework.core.MethodParameter bodyParameter, @Nullable org.springframework.core.MethodParameter actualParam, org.springframework.web.server.ServerWebExchange exchange)
      Write a given body to the response with HttpMessageWriter.
      Parameters:
      body - the object to write
      bodyParameter - the MethodParameter of the body to write
      actualParam - the actual return type of the method that returned the value; could be different from bodyParameter when processing HttpEntity for example
      exchange - the current exchange
      Returns:
      indicates completion or error
      Since:
      5.0.2