...
By default, if the cxf-rt-transports-http-hc module is found on the classpath, CXF will use the HttpAsyncClient based implementation for any Async calls, but will continue to use the HttpURLConnection based transport for synchronous calls. This allows a good balance of performance for the common synchronous cases with scalability for the asynchronous cases. However, using a contextual property of "use.async.http.conduit" and set to true/false, you can control whether the async or blocking version is used.
Setting Credentials
The "normal" CXF/JAX-WS method of setting user credentials via the BindingProvider.USERNAME_PROPERTY/PASSWORD_PROPERTY will work with the Async transport as well. However, the Async transport does have some additional capabilities around NTLM that can be leveraged. In order to use that, you need to:
- Turn on the AutoRedirect and turn off the Chunking for the Conduit. This will allow CXF to cache the response in a manner that will allow the transport to keep resending the request during the authentication negotiation.
- Set the property "org.apache.http.auth.Credentials" to an instance of the Credentials. For example:
Code Block java java Credentials creds = new NTCredentials("username", "pswd", null, "domain"); bp.getRequestContext().put(Credentials.class.getName(), creds);
Configuration
The Asynchronous HTTP Transport has several options that can set using Bus properties or via the OSGi configuration services to control various aspects of the underlying Apache HTTP Components HttpAsyncClient objects.
...