Class ProtobufResponseConverterFunction

java.lang.Object
com.linecorp.armeria.server.protobuf.ProtobufResponseConverterFunction
All Implemented Interfaces:
ResponseConverterFunction

@UnstableApi
public final class ProtobufResponseConverterFunction
extends Object
implements ResponseConverterFunction
A ResponseConverterFunction which creates an HttpResponse with content-type: application/protobuf or content-type: application/json; charset=utf-8. If the returned object is an instance of MessageLite, the object can be converted to either Protocol Buffers or JSON format.

Conversion of multiple Protobuf messages

A sequence of Protocol Buffer messages can not be handled by this ResponseConverterFunction, because Protocol Buffers wire format is not self-delimiting. See Streaming Multiple Messages for more information. However, Publisher, Stream and Iterable are supported when converting to JSON array. JavaScript Object Notation (JSON) Text Sequences is also supported for Publisher, Stream.

Note that this ResponseConverterFunction 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.Printer. The JsonFormat.printer() is used by default to format the response content.