Class ResponseBodyEmitterReturnValueHandler

java.lang.Object
org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler
All Implemented Interfaces:
org.springframework.web.method.support.HandlerMethodReturnValueHandler

public class ResponseBodyEmitterReturnValueHandler extends Object implements org.springframework.web.method.support.HandlerMethodReturnValueHandler
Handler for return values of type ResponseBodyEmitter and subclasses such as SseEmitter including the same types wrapped with ResponseEntity.

As of 5.0 also supports reactive return value types for any reactive library with registered adapters in ReactiveAdapterRegistry.

Since:
4.2
Author:
Rossen Stoyanchev
  • Constructor Summary

    Constructors
    Constructor
    Description
    ResponseBodyEmitterReturnValueHandler(List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters)
    Simple constructor with reactive type support based on a default instance of ReactiveAdapterRegistry, SyncTaskExecutor, and ContentNegotiationManager with an Accept header strategy.
    ResponseBodyEmitterReturnValueHandler(List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters, org.springframework.core.ReactiveAdapterRegistry registry, org.springframework.core.task.TaskExecutor executor, org.springframework.web.accept.ContentNegotiationManager manager)
    Complete constructor with pluggable "reactive" type support.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    handleReturnValue(Object returnValue, org.springframework.core.MethodParameter returnType, org.springframework.web.method.support.ModelAndViewContainer mavContainer, org.springframework.web.context.request.NativeWebRequest webRequest)
     
    boolean
    supportsReturnType(org.springframework.core.MethodParameter returnType)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ResponseBodyEmitterReturnValueHandler

      public ResponseBodyEmitterReturnValueHandler(List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters)
      Simple constructor with reactive type support based on a default instance of ReactiveAdapterRegistry, SyncTaskExecutor, and ContentNegotiationManager with an Accept header strategy.
    • ResponseBodyEmitterReturnValueHandler

      public ResponseBodyEmitterReturnValueHandler(List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters, org.springframework.core.ReactiveAdapterRegistry registry, org.springframework.core.task.TaskExecutor executor, org.springframework.web.accept.ContentNegotiationManager manager)
      Complete constructor with pluggable "reactive" type support.
      Parameters:
      messageConverters - converters to write emitted objects with
      registry - for reactive return value type support
      executor - for blocking I/O writes of items emitted from reactive types
      manager - for detecting streaming media types
      Since:
      5.0
  • Method Details

    • supportsReturnType

      public boolean supportsReturnType(org.springframework.core.MethodParameter returnType)
      Specified by:
      supportsReturnType in interface org.springframework.web.method.support.HandlerMethodReturnValueHandler
    • handleReturnValue

      public void handleReturnValue(@Nullable Object returnValue, org.springframework.core.MethodParameter returnType, org.springframework.web.method.support.ModelAndViewContainer mavContainer, org.springframework.web.context.request.NativeWebRequest webRequest) throws Exception
      Specified by:
      handleReturnValue in interface org.springframework.web.method.support.HandlerMethodReturnValueHandler
      Throws:
      Exception