[英]Verifying CXF HttpAsyncClient use of use.async.http.conduit contextual property
[英]Using CXF HttpAsyncClient through setting use.async.http.conduit contextual property
我試圖根據文檔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);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.