...
This client transport supports HTTP/2 (when enabled using org.apache.cxf.transports.http2.enabled property, see Configuration section below).
Using the HTTP Components 4.x/5.x Transport from Java Code
...
- 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.
Force the use of the Async transport even for synchronous calls
Code Block java java bp.getRequestContext().put("use.async.http.conduit", Boolean.TRUE); bp.getRequestContext().put("org.apache.cxf.transports.http2.enabled", Boolean.TRUE); // optionally, enable HTTP/2
or using AsyncHTTPConduit.USE_ASYNC constant
Code Block java java bp.getRequestContext().put(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE); bp.getRequestContext().put(AsyncHTTPConduit.ENABLE_HTTP2, Boolean.TRUE); // optionally, enable HTTP/2
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);
Netty 4.x
Apache CXF also offers an HTTP client transport that is based on Netty 4.x. Its Maven artifactId is cxf-rt-transports-http-netty-client.
This client transport supports HTTP/2 (when enabled using org.apache.cxf.transports.http2.enabled property, see Configuration section below).
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.
...
Settings related to HTTP/2 support (Apache CXF versions 4.0.2+/3.6.1+/3.5.7+/3.4.11+):
org.apache.cxf.transports.http2.enabled | true | false | Allows HTTP/2 protocol if supported by the server. Default is false. |
Settings related to Apache HttpAsyncClient threads and selectors:
...