如何在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);