本文介绍了通过设置use.async.http.conduit上下文属性使用CXF HttpAsyncClient的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据文档

但是我不知道在我的应用程序中设置这种上下文属性的位置/方式。

However i don't know where/how to set those kind of contextual properties in my app.

我正在使用基于代理的客户端

I am using a proxy based client through

JAXRSClientFactoryBean factoryBean = new JAXRSClientFactoryBean();
factoryBean.setAddress("http://localhost:6061/services");
factoryBean.setServiceClass(MyServiceInterface.class);
documentCapture = (MyServiceInterface) factoryBean.create();

有谁知道如何设置这种上下文属性并强制使用HttpAsyncClient?

Does anyone knows how to set those kind of contextual properties and force HttpAsyncClient?

谢谢!

推荐答案

您可以在org.apache.cxf.endpoint上设置这些属性。客户。只需通过调用静态方法获取它:ClientProxy.getClient(proxy)。

You can set these properties on the org.apache.cxf.endpoint.Client. Just grab it by calling the static method: ClientProxy.getClient(proxy).

在您的情况下:

JAXRSClientFactoryBean factoryBean = new JAXRSClientFactoryBean();
factoryBean.setAddress("http://localhost:6061/services");
MyServiceInterface documentCapture = factoryBean.create(MyServiceInterface.class);

Client client = ClientProxy.getClient(documentCapture);
client.getRequestContext().put("use.async.http.conduit", Boolean.TRUE);

这篇关于通过设置use.async.http.conduit上下文属性使用CXF HttpAsyncClient的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 20:08