Class ResponseEntityResultHandler

All Implemented Interfaces:
org.springframework.core.Ordered, HandlerResultHandler

public class ResponseEntityResultHandler extends AbstractMessageWriterResultHandler implements HandlerResultHandler
Handles return values of type HttpEntity, ResponseEntity, HttpHeaders, ErrorResponse, and ProblemDetail.

By default the order for this result handler is set to 0. It is generally safe to place it early in the order as it looks for a concrete return type.

Since:
5.0
Author:
Rossen Stoyanchev
  • Constructor Details

    • ResponseEntityResultHandler

      public ResponseEntityResultHandler(List<org.springframework.http.codec.HttpMessageWriter<?>> writers, RequestedContentTypeResolver resolver)
      Basic constructor with a default ReactiveAdapterRegistry.
      Parameters:
      writers - the writers for serializing to the response body
      resolver - to determine the requested content type
    • ResponseEntityResultHandler

      public ResponseEntityResultHandler(List<org.springframework.http.codec.HttpMessageWriter<?>> writers, RequestedContentTypeResolver resolver, org.springframework.core.ReactiveAdapterRegistry registry)
      Constructor with an ReactiveAdapterRegistry instance.
      Parameters:
      writers - the writers for serializing to the response body
      resolver - to determine the requested content type
      registry - for adaptation to reactive types
  • Method Details

    • supports

      public boolean supports(HandlerResult result)
      Description copied from interface: HandlerResultHandler
      Whether this handler supports the given HandlerResult.
      Specified by:
      supports in interface HandlerResultHandler
      Parameters:
      result - the result object to check
      Returns:
      whether this object can use the given result
    • handleResult

      public reactor.core.publisher.Mono<Void> handleResult(org.springframework.web.server.ServerWebExchange exchange, HandlerResult result)
      Description copied from interface: HandlerResultHandler
      Process the given result modifying response headers and/or writing data to the response.
      Specified by:
      handleResult in interface HandlerResultHandler
      Parameters:
      exchange - current server exchange
      result - the result from the handling
      Returns:
      Mono<Void> to indicate when request handling is complete.