使用JSON请求实施CXF JAX-RS客户端
我正在尝试开发一个客户,我将执行后期操作并通过服务请求中的JSON。
检查CXF的官方文档,我在下面找到了代码段:
Client client = ClientBuilder.newBuilder().newClient();
WebTarget target = client.target("http://localhost:8080/rs");
target = target.path("service").queryParam("a", "avalue");
Invocation.Builder builder = target.request();
Response response = builder.get();
Book book = builder.get(Book.class);
我知道这里的请求是“ a”,“ avalue”。如何调整此代码以将JSON字符串作为请求传递?
I am trying to develop a client where i will perform a POST operation and pass a json in the service request.
Checking CXF's official documentation i found the code snippet below:
Client client = ClientBuilder.newBuilder().newClient();
WebTarget target = client.target("http://localhost:8080/rs");
target = target.path("service").queryParam("a", "avalue");
Invocation.Builder builder = target.request();
Response response = builder.get();
Book book = builder.get(Book.class);
I understand that the request here is "a", "avalue". How can i tweak this code in order to pass a json string as the request?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论