我试图根据文档 http://cxf.apache.org/docs/asynchronous-client-http-transport.html 通过使用上下文属性“use.async.http.conduit”来强制使用 HttpAsyncClient
但是我不知道在哪里/如何在我的应用程序中设置此类上下文属性。
我通过
使用基于代理的客户端JAXRSClientFactoryBean factoryBean = new JAXRSClientFactoryBean();
factoryBean.setAddress("http://localhost:6061/services");
factoryBean.setServiceClass(MyServiceInterface.class);
documentCapture = (MyServiceInterface) factoryBean.create();
有人知道如何设置此类上下文属性并强制 HttpAsyncClient 吗?
谢谢!
最佳答案
您可以在 org.apache.cxf.endpoint.Client 上设置这些属性。只需调用静态方法 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);
关于java - 通过设置 use.async.http.conduit 上下文属性来使用 CXF HttpAsyncClient,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20497003/