public class ResponseBodyEmitterReturnValueHandler extends Object implements org.springframework.web.method.support.HandlerMethodReturnValueHandler
ResponseBodyEmitter
and sub-classes
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
.
Constructor and 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.
|
Modifier and Type | Method and 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) |
public ResponseBodyEmitterReturnValueHandler(List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters)
ReactiveAdapterRegistry
,
SyncTaskExecutor
, and
ContentNegotiationManager
with an Accept header strategy.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)
messageConverters
- converters to write emitted objects withregistry
- for reactive return value type supportexecutor
- for blocking I/O writes of items emitted from reactive typesmanager
- for detecting streaming media typespublic boolean supportsReturnType(org.springframework.core.MethodParameter returnType)
supportsReturnType
in interface org.springframework.web.method.support.HandlerMethodReturnValueHandler
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
handleReturnValue
in interface org.springframework.web.method.support.HandlerMethodReturnValueHandler
Exception