Class ProtobufHttpMessageWriter
java.lang.Object
org.springframework.http.codec.EncoderHttpMessageWriter<com.google.protobuf.Message>
org.springframework.http.codec.protobuf.ProtobufHttpMessageWriter
- All Implemented Interfaces:
- 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()).
- Since:
- 5.1
- Author:
- Sebastien Deleuze
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a newProtobufHttpMessageWriterwith a defaultProtobufEncoder.ProtobufHttpMessageWriter(Encoder<com.google.protobuf.Message> encoder) Create a newProtobufHttpMessageWriterwith the given encoder.
- 
Method SummaryModifier and TypeMethodDescriptionreactor.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.Methods inherited from class org.springframework.http.codec.EncoderHttpMessageWritercanWrite, getEncoder, getWritableMediaTypes, getWritableMediaTypes, getWriteHints, write
- 
Constructor Details- 
ProtobufHttpMessageWriterpublic ProtobufHttpMessageWriter()Create a newProtobufHttpMessageWriterwith a defaultProtobufEncoder.
- 
ProtobufHttpMessageWriterCreate a newProtobufHttpMessageWriterwith the given encoder.- Parameters:
- encoder- the Protobuf message encoder to use
 
 
- 
- 
Method Details- 
writepublic reactor.core.publisher.Mono<Void> write(Publisher<? extends com.google.protobuf.Message> inputStream, ResolvableType elementType, @Nullable MediaType mediaType, ReactiveHttpOutputMessage message, Map<String, Object> hints) Description copied from interface:HttpMessageWriterWrite a given stream of object to the output message.- Specified by:
- writein interface- HttpMessageWriter<com.google.protobuf.Message>
- Overrides:
- writein class- EncoderHttpMessageWriter<com.google.protobuf.Message>
- Parameters:
- inputStream- the objects to write
- elementType- 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- nullto indicate that the default content type of the writer must be used)
- message- the message to write to
- hints- additional information about how to encode and write
- Returns:
- indicates completion or error
 
 
-