类 ResponseBodyEmitterReturnValueHandler
java.lang.Object
cn.taketoday.web.handler.method.ResponseBodyEmitterReturnValueHandler
- 所有已实现的接口:
SmartReturnValueHandler,ReturnValueHandler
public class ResponseBodyEmitterReturnValueHandler
extends Object
implements SmartReturnValueHandler
Handler for return values of type
ResponseBodyEmitter and sub-classes
such as SseEmitter including the same types wrapped with
ResponseEntity.
also supports reactive return value types for any reactive
library with registered adapters in ReactiveAdapterRegistry.
- 从以下版本开始:
- 4.0 2022/4/9 13:36
- 作者:
- Rossen Stoyanchev, Harry Yang
-
嵌套类概要
嵌套类修饰符和类型类说明private classResponseBodyEmitter.Handler that writes with HttpMessageConverter's. -
字段概要
字段从接口继承的字段 cn.taketoday.web.ReturnValueHandler
NONE_RETURN_VALUE -
构造器概要
构造器构造器说明ResponseBodyEmitterReturnValueHandler(List<HttpMessageConverter<?>> messageConverters) Simple constructor with reactive type support based on a default instance ofReactiveAdapterRegistry,SyncTaskExecutor, andContentNegotiationManagerwith an Accept header strategy.ResponseBodyEmitterReturnValueHandler(List<HttpMessageConverter<?>> messageConverters, cn.taketoday.core.ReactiveAdapterRegistry registry, cn.taketoday.core.task.TaskExecutor executor, ContentNegotiationManager manager) Complete constructor with pluggable "reactive" type support.ResponseBodyEmitterReturnValueHandler(List<HttpMessageConverter<?>> messageConverters, ContentNegotiationManager manager) Complete constructor with pluggable "reactive" type support. -
方法概要
修饰符和类型方法说明voidhandleReturnValue(RequestContext request, Object handler, Object returnValue) Handle result of the handlerprivate static List<HttpMessageConverter<?>>initSseConverters(List<HttpMessageConverter<?>> converters) booleansupportsHandler(Object handler) If thisReturnValueHandlersupports the target handlerbooleansupportsHandler(Object handler, Object returnValue) handle handler and its return valuebooleansupportsReturnType(cn.taketoday.core.MethodParameter returnType) booleansupportsReturnValue(Object returnValue) If thisReturnValueHandlersupports the target handler's result
-
字段详细资料
-
sseMessageConverters
-
reactiveHandler
-
-
构造器详细资料
-
ResponseBodyEmitterReturnValueHandler
Simple constructor with reactive type support based on a default instance ofReactiveAdapterRegistry,SyncTaskExecutor, andContentNegotiationManagerwith an Accept header strategy. -
ResponseBodyEmitterReturnValueHandler
public ResponseBodyEmitterReturnValueHandler(List<HttpMessageConverter<?>> messageConverters, ContentNegotiationManager manager) Complete constructor with pluggable "reactive" type support.- 参数:
messageConverters- converters to write emitted objects withmanager- for detecting streaming media types
-
ResponseBodyEmitterReturnValueHandler
public ResponseBodyEmitterReturnValueHandler(List<HttpMessageConverter<?>> messageConverters, cn.taketoday.core.ReactiveAdapterRegistry registry, cn.taketoday.core.task.TaskExecutor executor, ContentNegotiationManager manager) Complete constructor with pluggable "reactive" type support.- 参数:
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 types
-
-
方法详细资料
-
initSseConverters
private static List<HttpMessageConverter<?>> initSseConverters(List<HttpMessageConverter<?>> converters) -
supportsHandler
从接口复制的说明:ReturnValueHandlerIf thisReturnValueHandlersupports the target handlerThis method can test this
ReturnValueHandlersupports the target handler in application startup time , static match- 指定者:
supportsHandler在接口中ReturnValueHandler- 指定者:
supportsHandler在接口中SmartReturnValueHandler- 参数:
handler- Target HTTP handler- 返回:
- If this
ReturnValueHandlersupports the target handler
-
supportsHandler
从接口复制的说明:SmartReturnValueHandlerhandle handler and its return valuedefault is
supportsHandlerorsupportsReturnValuereturnstrue- 指定者:
supportsHandler在接口中SmartReturnValueHandler- 参数:
handler- target handlerreturnValue- handler's return value
-
supportsReturnType
public boolean supportsReturnType(cn.taketoday.core.MethodParameter returnType) -
supportsReturnValue
从接口复制的说明:ReturnValueHandlerIf thisReturnValueHandlersupports the target handler's resultThis method can test this
ReturnValueHandlersupports the target handler in application runtime- 指定者:
supportsReturnValue在接口中ReturnValueHandler- 参数:
returnValue- Target handler's return-value or result- 返回:
- If this
ReturnValueHandlersupports the target handler's result
-
handleReturnValue
public void handleReturnValue(RequestContext request, @Nullable Object handler, @Nullable Object returnValue) throws Exception 从接口复制的说明:ReturnValueHandlerHandle result of the handler- 指定者:
handleReturnValue在接口中ReturnValueHandler- 参数:
request- Current HTTP request contexthandler- Target HTTP handlerreturnValue- Handler execution result OrHandlerExceptionHandlerreturn value- 抛出:
Exception- return-value handled failed
-