Class ProtobufRequestConverterFunction

java.lang.Object
com.linecorp.armeria.server.protobuf.ProtobufRequestConverterFunction
All Implemented Interfaces:
RequestConverterFunction

@UnstableApi public final class ProtobufRequestConverterFunction extends Object implements RequestConverterFunction
A RequestConverterFunction which converts a Protocol Buffers or JSON body of the AggregatedHttpRequest to an object. The built-in parser of Message for Protocol Buffers is applied only when the content-type of RequestHeaders is either one of MediaType.PROTOBUF or MediaType.OCTET_STREAM or the MediaType.subtype() contains "protobuf". The JsonFormat.Parser for JSON is applied only when the content-type of the RequestHeaders is either MediaType.JSON or ends with +json.

Conversion of multiple Protobuf messages

A sequence of Protocol Buffer messages can not be handled by this RequestConverterFunction, because Protocol Buffers wire format is not self-delimiting. See Streaming Multiple Messages for more information. However, Collection types such as List<Message> and Set<Message> are supported when converted from JSON array.

Note that this RequestConverterFunction is applied to an annotated service by default, so you don't have to specify this converter explicitly unless you want to use your own JsonFormat.Parser and ExtensionRegistry.