如何在CXF-JAXRS客户端中禁用分块 [英] How to disable chunking in cxf-jaxrs client
本文介绍了如何在CXF-JAXRS客户端中禁用分块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要联系专有的http服务,而不支持数据块. 我开始使用此处记录的,因此我以这种方式创建了客户端:
I need to contact a proprietary http service, not supporting chunks. I started using as documented here so i create the client this way:
Client client = ClientBuilder.newBuilder().newClient();
WebTarget target = client.target("http://localhost:8080/rs");
问题在于如何配置客户端,如何禁用分块.
The problem is how to configure the client, how to disable chunking. The way documented here doesn't work for me (wrong classes).
预先感谢
推荐答案
相反,使用jaxrs标准客户端,您可以使用cxf-rt-rs-client
依赖项的org.apache.cxf.jaxrs.client.WebClient
部分.
Rather that using jaxrs standard Client you can use org.apache.cxf.jaxrs.client.WebClient
part of cxf-rt-rs-client
dependency.
WebClient client = WebClient.create("http://localhost:8080/rs");
WebClient.getConfig(client).getHttpConduit().getClient().setAllowChunking(false);
这篇关于如何在CXF-JAXRS客户端中禁用分块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文