我创建了一个 .proto 消息,我正在公开一个看起来像这样的休息服务
@Path("/test")
public interface test{
@POST
@Produces("application/x-protobuf")
@Consumes("application/x-protobuf")
public Response getProperties(TestRequest testrq);
}
现在 TestRequest 是 .protobuf 的 Java 生成文件,我如何在请求正文中传递它?
这将是 .proto 文件格式
message TestRequest
{
string id = 1;
string name = 2;
enum TestType
{
Test=1
}
TestType testType = 3;
}
最佳答案
给Protoman如果您需要一个简单的 protobuf api 客户端,请尝试一下。
免责声明:这是我的副业
关于java - 如何形成http请求体的protobuf资源部分,并通过dhc客户端或 postman 进行测试以实现restful服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39314999/