Class ProtobufBodyHandler<T extends com.google.protobuf.Message>

java.lang.Object
io.micronaut.protobuf.handler.ProtobufBodyHandler<T>
Type Parameters:
T - The body type
All Implemented Interfaces:
io.micronaut.http.body.MessageBodyHandler<T>, io.micronaut.http.body.MessageBodyReader<T>, io.micronaut.http.body.MessageBodyWriter<T>

@Singleton @Produces({"application/x-protobuf","application/protobuf"}) @Consumes({"application/x-protobuf","application/protobuf"}) public final class ProtobufBodyHandler<T extends com.google.protobuf.Message> extends Object implements io.micronaut.http.body.MessageBodyHandler<T>
Message body handler for protobuf Messages.
Since:
4.0.0
Author:
Jonas Konrad
  • Constructor Summary

    Constructors
    Constructor
    Description
    ProtobufBodyHandler(ProtobufferCodec codec, com.google.protobuf.ExtensionRegistry extensionRegistry)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    read(io.micronaut.core.type.Argument<T> type, io.micronaut.http.MediaType mediaType, io.micronaut.core.type.Headers httpHeaders, InputStream inputStream)
     
    void
    writeTo(io.micronaut.core.type.Argument<T> type, io.micronaut.http.MediaType mediaType, T object, io.micronaut.core.type.MutableHeaders outgoingHeaders, OutputStream outputStream)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.micronaut.http.body.MessageBodyReader

    isReadable, read

    Methods inherited from interface io.micronaut.http.body.MessageBodyWriter

    createSpecific, isBlocking, isWriteable, writeTo
  • Constructor Details

    • ProtobufBodyHandler

      public ProtobufBodyHandler(ProtobufferCodec codec, com.google.protobuf.ExtensionRegistry extensionRegistry)
  • Method Details

    • read

      public T read(io.micronaut.core.type.Argument<T> type, io.micronaut.http.MediaType mediaType, io.micronaut.core.type.Headers httpHeaders, InputStream inputStream) throws io.micronaut.http.codec.CodecException
      Specified by:
      read in interface io.micronaut.http.body.MessageBodyReader<T extends com.google.protobuf.Message>
      Throws:
      io.micronaut.http.codec.CodecException
    • writeTo

      public void writeTo(io.micronaut.core.type.Argument<T> type, io.micronaut.http.MediaType mediaType, T object, io.micronaut.core.type.MutableHeaders outgoingHeaders, OutputStream outputStream) throws io.micronaut.http.codec.CodecException
      Specified by:
      writeTo in interface io.micronaut.http.body.MessageBodyWriter<T extends com.google.protobuf.Message>
      Throws:
      io.micronaut.http.codec.CodecException