通过设置use.async.http.conduit上下文属性使用CXF HttpAsyncClient [英] Using CXF HttpAsyncClient through setting use.async.http.conduit contextual property

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

问题描述

根据文档 http://cxf.apache.org/docs/asynchronous-client-http-transport.html

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

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆