类 ProtobufHttpMessageWriter
java.lang.Object
cn.taketoday.http.codec.EncoderHttpMessageWriter<com.google.protobuf.Message>
cn.taketoday.http.codec.protobuf.ProtobufHttpMessageWriter
- 所有已实现的接口:
HttpMessageWriter<com.google.protobuf.Message>
public class ProtobufHttpMessageWriter
extends EncoderHttpMessageWriter<com.google.protobuf.Message>
HttpMessageWriter that can write a protobuf Message and adds
X-Protobuf-Schema, X-Protobuf-Message headers and a
delimited=true parameter is added to the content type if a flux is serialized.
For HttpMessageReader, just use
new DecoderHttpMessageReader(new ProtobufDecoder()).
- 从以下版本开始:
- 4.0
- 作者:
- Sebastien Deleuze
- 另请参阅:
-
字段概要
字段 -
构造器概要
构造器构造器说明Create a newProtobufHttpMessageWriterwith a defaultProtobufEncoder.ProtobufHttpMessageWriter(cn.taketoday.core.codec.Encoder<com.google.protobuf.Message> encoder) Create a newProtobufHttpMessageWriterwith the given encoder. -
方法概要
修饰符和类型方法说明private static com.google.protobuf.Message.BuildergetMessageBuilder(Class<?> clazz) Create a newMessage.Builderinstance for the given class.reactor.core.publisher.Mono<Void>write(org.reactivestreams.Publisher<? extends com.google.protobuf.Message> inputStream, cn.taketoday.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String, Object> hints) Write an given stream of object to the output message.从类继承的方法 cn.taketoday.http.codec.EncoderHttpMessageWriter
canWrite, getEncoder, getWritableMediaTypes, getWritableMediaTypes, getWriteHints, write
-
字段详细资料
-
构造器详细资料
-
ProtobufHttpMessageWriter
public ProtobufHttpMessageWriter()Create a newProtobufHttpMessageWriterwith a defaultProtobufEncoder. -
ProtobufHttpMessageWriter
public ProtobufHttpMessageWriter(cn.taketoday.core.codec.Encoder<com.google.protobuf.Message> encoder) Create a newProtobufHttpMessageWriterwith the given encoder.- 参数:
encoder- the Protobuf message encoder to use
-
-
方法详细资料
-
write
public reactor.core.publisher.Mono<Void> write(org.reactivestreams.Publisher<? extends com.google.protobuf.Message> inputStream, cn.taketoday.core.ResolvableType elementType, @Nullable MediaType mediaType, ReactiveHttpOutputMessage message, Map<String, Object> hints) 从接口复制的说明:HttpMessageWriterWrite an given stream of object to the output message.- 指定者:
write在接口中HttpMessageWriter<com.google.protobuf.Message>- 覆盖:
write在类中EncoderHttpMessageWriter<com.google.protobuf.Message>- 参数:
inputStream- the objects to writeelementType- the type of objects in the stream which must have been previously checked viaHttpMessageWriter.canWrite(ResolvableType, MediaType)mediaType- the content type for the write (possiblynullto indicate that the default content type of the writer must be used)message- the message to write tohints- additional information about how to encode and write- 返回:
- indicates completion or error
-
getMessageBuilder
private static com.google.protobuf.Message.Builder getMessageBuilder(Class<?> clazz) throws Exception Create a newMessage.Builderinstance for the given class.This method uses a ConcurrentHashMap for caching method lookups.
- 抛出:
Exception
-