类 ProtobufHttpMessageWriter
- java.lang.Object
- org.springframework.http.codec.EncoderHttpMessageWriter<com.google.protobuf.Message>
- org.springframework.http.codec.protobuf.ProtobufHttpMessageWriter
- 所有已实现的接口:
HttpMessageWriter<com.google.protobuf.Message>
public class ProtobufHttpMessageWriter extends EncoderHttpMessageWriter<com.google.protobuf.Message>
HttpMessageWriter
that can write a protobufMessage
and addsX-Protobuf-Schema
,X-Protobuf-Message
headers and adelimited=true
parameter is added to the content type if a flux is serialized.For
HttpMessageReader
, just usenew DecoderHttpMessageReader(new ProtobufDecoder())
.- 从以下版本开始:
- 5.1
- 作者:
- S茅bastien Deleuze
- 另请参阅:
ProtobufEncoder
构造器概要
构造器 构造器 说明 ProtobufHttpMessageWriter()
Create a newProtobufHttpMessageWriter
with a defaultProtobufEncoder
.ProtobufHttpMessageWriter(Encoder<com.google.protobuf.Message> encoder)
Create a newProtobufHttpMessageWriter
with the given encoder.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 reactor.core.publisher.Mono<Void>
write(org.reactivestreams.Publisher<? extends com.google.protobuf.Message> inputStream, ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String,Object> hints)
Write an given stream of object to the output message.从类继承的方法 org.springframework.http.codec.EncoderHttpMessageWriter
canWrite, getEncoder, getWritableMediaTypes, getWriteHints, write
构造器详细资料
ProtobufHttpMessageWriter
public ProtobufHttpMessageWriter()
Create a newProtobufHttpMessageWriter
with a defaultProtobufEncoder
.
ProtobufHttpMessageWriter
public ProtobufHttpMessageWriter(Encoder<com.google.protobuf.Message> encoder)
Create a newProtobufHttpMessageWriter
with 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, ResolvableType elementType, @Nullable MediaType mediaType, ReactiveHttpOutputMessage message, Map<String,Object> hints)
从接口复制的说明:HttpMessageWriter
Write 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 (possiblynull
to 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