Class ProtobufHttpMessageConverter

  • All Implemented Interfaces:
    Direct Known Subclasses:

    public class ProtobufHttpMessageConverter
    extends AbstractHttpMessageConverter<>
    An HttpMessageConverter that reads and writes using Google Protocol Buffers.

    To generate Message Java classes, you need to install the protoc binary.

    This converter supports by default "application/x-protobuf" and "text/plain" with the official "" library. Other formats can be supported with one of the following additional libraries on the classpath:

    • "application/json", "application/xml", and "text/html" (write-only) with the "com.googlecode.protobuf-java-format:protobuf-java-format" third-party library
    • "application/json" with the official "" for Protobuf 3 (see ProtobufJsonFormatHttpMessageConverter for a configurable variant)

    Requires Protobuf 2.6 or higher (and Protobuf Java Format 1.4 or higher for formatting). This converter will auto-adapt to Protobuf 3 and its default protobuf-java-util JSON format if the Protobuf 2 based protobuf-java-format isn't present; however, for more explicit JSON setup on Protobuf 3, consider ProtobufJsonFormatHttpMessageConverter.

    Alex Antonov, Brian Clozel, Juergen Hoeller, Sebastien Deleuze
    See Also:
    FormatFactory, JsonFormat, ProtobufJsonFormatHttpMessageConverter