1

I am trying to force the use of HttpAsyncClient through the use of the contextual property "use.async.http.conduit" according documentation 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();

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

Thanks!

Rafael
  • 2,521
  • 2
  • 33
  • 59

1 Answers1

2

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

In your case:

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);
tomking
  • 21
  • 2
  • So it is a matter of client configuration? ... i was expecting to define something on the server side. Thanks. – Rafael Jan 23 '14 at 11:09
  • This didn't work for me because of an ClassCastException. I used this solution http://stackoverflow.com/questions/14810825/prevent-jaxrsclientfactory-to-reuse-connections – Christian Jul 14 '14 at 08:47