public class ProtobufJsonFormatHttpMessageConverter extends ProtobufHttpMessageConverter
ProtobufHttpMessageConverter
which enforces the use of Protobuf 3 and
its official library "com.google.protobuf:protobuf-java-util"
for JSON processing.
Most importantly, this class allows for custom JSON parser and printer configurations
through the JsonFormat
utility. If no special parser or printer configuration is
given, default variants will be used instead.
Requires Protobuf 3.x and "com.google.protobuf:protobuf-java-util"
3.x,
with 3.3 or higher recommended.
JsonFormat.parser()
,
JsonFormat.printer()
,
ProtobufJsonFormatHttpMessageConverter(JsonFormat.Parser, JsonFormat.Printer)
DEFAULT_CHARSET, PROTOBUF, X_PROTOBUF_MESSAGE_HEADER, X_PROTOBUF_SCHEMA_HEADER
logger
Constructor and Description |
---|
ProtobufJsonFormatHttpMessageConverter()
Construct a new
ProtobufJsonFormatHttpMessageConverter with default
JsonFormat.Parser and JsonFormat.Printer configuration. |
ProtobufJsonFormatHttpMessageConverter(com.google.protobuf.util.JsonFormat.Parser parser,
com.google.protobuf.util.JsonFormat.Printer printer)
Construct a new
ProtobufJsonFormatHttpMessageConverter with the given
JsonFormat.Parser and JsonFormat.Printer configuration. |
ProtobufJsonFormatHttpMessageConverter(com.google.protobuf.util.JsonFormat.Parser parser,
com.google.protobuf.util.JsonFormat.Printer printer,
com.google.protobuf.ExtensionRegistry extensionRegistry)
Construct a new
ProtobufJsonFormatHttpMessageConverter with the given
JsonFormat.Parser and JsonFormat.Printer configuration, also
accepting a registry that specifies protocol message extensions. |
ProtobufJsonFormatHttpMessageConverter(com.google.protobuf.util.JsonFormat.Parser parser,
com.google.protobuf.util.JsonFormat.Printer printer,
ExtensionRegistryInitializer registryInitializer)
Deprecated.
|
canWrite, getDefaultContentType, readInternal, supports, writeInternal
addDefaultHeaders, canRead, canRead, canWrite, getContentLength, getDefaultCharset, getSupportedMediaTypes, read, setDefaultCharset, setSupportedMediaTypes, write
public ProtobufJsonFormatHttpMessageConverter()
ProtobufJsonFormatHttpMessageConverter
with default
JsonFormat.Parser
and JsonFormat.Printer
configuration.public ProtobufJsonFormatHttpMessageConverter(@Nullable com.google.protobuf.util.JsonFormat.Parser parser, @Nullable com.google.protobuf.util.JsonFormat.Printer printer)
ProtobufJsonFormatHttpMessageConverter
with the given
JsonFormat.Parser
and JsonFormat.Printer
configuration.parser
- the JSON parser configurationprinter
- the JSON printer configurationpublic ProtobufJsonFormatHttpMessageConverter(@Nullable com.google.protobuf.util.JsonFormat.Parser parser, @Nullable com.google.protobuf.util.JsonFormat.Printer printer, @Nullable com.google.protobuf.ExtensionRegistry extensionRegistry)
ProtobufJsonFormatHttpMessageConverter
with the given
JsonFormat.Parser
and JsonFormat.Printer
configuration, also
accepting a registry that specifies protocol message extensions.parser
- the JSON parser configurationprinter
- the JSON printer configurationextensionRegistry
- the registry to populate@Deprecated public ProtobufJsonFormatHttpMessageConverter(@Nullable com.google.protobuf.util.JsonFormat.Parser parser, @Nullable com.google.protobuf.util.JsonFormat.Printer printer, @Nullable ExtensionRegistryInitializer registryInitializer)
ProtobufJsonFormatHttpMessageConverter(JsonFormat.Parser, JsonFormat.Printer, ExtensionRegistry)
ProtobufJsonFormatHttpMessageConverter
with the given
JsonFormat.Parser
and JsonFormat.Printer
configuration, also
accepting an initializer that allows the registration of message extensions.parser
- the JSON parser configurationprinter
- the JSON printer configurationregistryInitializer
- an initializer for message extensions