views:

33

answers:

1

Hi, I am trying to implement protocol buffers for client/server using REST. I am still a bit confused if I need to send protocol buffers request in byte format?

I mean, in my client code, do I need to serialize object to byte array? For example

protoRequest.build.toByteArray()

And in the server, do I need to c

   @POST
   @Consumes("application/octet-stream")
   public byte[] processProtoRequest(byte[] protoRequest) {
   ProtoRequest.Builder request = ProtoRequest.newBuilder();
   request.mergeFrom(protoRequest)
}

Is this the right thing to do?

Thanks

David

A: 

You could encode the result of SerializeToString using base64.

Benoit Aubuchon