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())
.
ProtobufEncoder
Constructor and Description |
---|
ProtobufHttpMessageWriter()
Create a new
ProtobufHttpMessageWriter with a default ProtobufEncoder . |
ProtobufHttpMessageWriter(Encoder<com.google.protobuf.Message> encoder)
Create a new
ProtobufHttpMessageWriter with the given encoder. |
Modifier and Type | Method and Description |
---|---|
reactor.core.publisher.Mono<Void> |
write(Publisher<? extends com.google.protobuf.Message> inputStream,
ResolvableType elementType,
MediaType mediaType,
ReactiveHttpOutputMessage message,
Map<String,Object> hints)
Write a given stream of object to the output message.
|
canWrite, getEncoder, getWritableMediaTypes, getWritableMediaTypes, getWriteHints, write
public ProtobufHttpMessageWriter()
ProtobufHttpMessageWriter
with a default ProtobufEncoder
.public ProtobufHttpMessageWriter(Encoder<com.google.protobuf.Message> encoder)
ProtobufHttpMessageWriter
with the given encoder.encoder
- the Protobuf message encoder to usepublic reactor.core.publisher.Mono<Void> write(Publisher<? extends com.google.protobuf.Message> inputStream, ResolvableType elementType, @Nullable MediaType mediaType, ReactiveHttpOutputMessage message, Map<String,Object> hints)
HttpMessageWriter
write
in interface HttpMessageWriter<com.google.protobuf.Message>
write
in class EncoderHttpMessageWriter<com.google.protobuf.Message>
inputStream
- the objects to writeelementType
- the type of objects in the stream which must have been
previously checked via HttpMessageWriter.canWrite(ResolvableType, MediaType)
mediaType
- the content type for the write (possibly null
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