类 AbstractEncoderMethodReturnValueHandler
- java.lang.Object
- org.springframework.messaging.handler.invocation.reactive.AbstractEncoderMethodReturnValueHandler
- 所有已实现的接口:
HandlerMethodReturnValueHandler
public abstract class AbstractEncoderMethodReturnValueHandler extends Object implements HandlerMethodReturnValueHandler
Base class for a return value handler that encodes return values toFlux<DataBuffer>
through the configuredEncoder
s.Subclasses must implement the abstract method
handleEncodedContent(reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer>, org.springframework.core.MethodParameter, org.springframework.messaging.Message<?>)
to handle the resulting encoded content.This handler should be ordered last since its
supportsReturnType(org.springframework.core.MethodParameter)
returnstrue
for any method parameter type.- 从以下版本开始:
- 5.2
- 作者:
- Rossen Stoyanchev
字段概要
从接口继承的字段 org.springframework.messaging.handler.invocation.reactive.HandlerMethodReturnValueHandler
DATA_BUFFER_FACTORY_HEADER
构造器概要
构造器 限定符 构造器 说明 protected
AbstractEncoderMethodReturnValueHandler(List<Encoder<?>> encoders, ReactiveAdapterRegistry registry)
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 ReactiveAdapterRegistry
getAdapterRegistry()
The configured adapter registry.List<Encoder<?>>
getEncoders()
The configured encoders.protected abstract reactor.core.publisher.Mono<Void>
handleEncodedContent(reactor.core.publisher.Flux<DataBuffer> encodedContent, MethodParameter returnType, Message<?> message)
Subclasses implement this method to handle encoded values in some way such as creating and sending messages.protected abstract reactor.core.publisher.Mono<Void>
handleNoContent(MethodParameter returnType, Message<?> message)
Invoked for anull
return value, which could mean a void method or method returning an async type parameterized by void.reactor.core.publisher.Mono<Void>
handleReturnValue(Object returnValue, MethodParameter returnType, Message<?> message)
Handle the given return value.boolean
supportsReturnType(MethodParameter returnType)
Whether the given method return type is supported by this handler.
构造器详细资料
AbstractEncoderMethodReturnValueHandler
protected AbstractEncoderMethodReturnValueHandler(List<Encoder<?>> encoders, ReactiveAdapterRegistry registry)
方法详细资料
getEncoders
public List<Encoder<?>> getEncoders()
The configured encoders.
getAdapterRegistry
public ReactiveAdapterRegistry getAdapterRegistry()
The configured adapter registry.
supportsReturnType
public boolean supportsReturnType(MethodParameter returnType)
从接口复制的说明:HandlerMethodReturnValueHandler
Whether the given method return type is supported by this handler.- 指定者:
supportsReturnType
在接口中HandlerMethodReturnValueHandler
- 参数:
returnType
- the method return type to check- 返回:
true
if this handler supports the supplied return type;false
otherwise
handleReturnValue
public reactor.core.publisher.Mono<Void> handleReturnValue(@Nullable Object returnValue, MethodParameter returnType, Message<?> message)
从接口复制的说明:HandlerMethodReturnValueHandler
Handle the given return value.- 指定者:
handleReturnValue
在接口中HandlerMethodReturnValueHandler
- 参数:
returnValue
- the value returned from the handler methodreturnType
- the type of the return value. This type must have previously been passed toHandlerMethodReturnValueHandler.supportsReturnType(MethodParameter)
and it must have returnedtrue
.- 返回:
Mono<Void>
to indicate when handling is complete.
handleEncodedContent
protected abstract reactor.core.publisher.Mono<Void> handleEncodedContent(reactor.core.publisher.Flux<DataBuffer> encodedContent, MethodParameter returnType, Message<?> message)
Subclasses implement this method to handle encoded values in some way such as creating and sending messages.- 参数:
encodedContent
- the encoded content; eachDataBuffer
represents the fully-aggregated, encoded content for one value (i.e. payload) returned from the HandlerMethod.returnType
- return type of the handler method that produced the datamessage
- the input message handled by the handler method- 返回:
- completion
Mono<Void>
for the handling
handleNoContent
protected abstract reactor.core.publisher.Mono<Void> handleNoContent(MethodParameter returnType, Message<?> message)
Invoked for anull
return value, which could mean a void method or method returning an async type parameterized by void.- 参数:
returnType
- return type of the handler method that produced the datamessage
- the input message handled by the handler method- 返回:
- completion
Mono<Void>
for the handling