1

Does CXF 3.1.x really uses Apache HttpComponents - HttpClient for http transport? Maven dependencies does not list "Apache HttpComponents" as dependency nor do I see any HttpClient class in the CXF jars? However CXF JIRA CXF-6704 discusses about it?

I need access to HttpClient in CXF for NTLM support per connection basis which CXF by default relies on Java 6+ Authenticator which is set per JVM.

Stackee007
  • 3,196
  • 1
  • 26
  • 39

1 Answers1

2

CXF has a decoupled runtime layer. Mostly they start with cxf-rt-*.

In the case of transports, cxf-rt-transports-*.

Take a look at this. I believe that this is the HTTP Components transport runtime.

EDIT: I think this is for asynchronous transport - (looked at the pom after I posted this).

EDIT2: I did a little more research on this and found this documentation. It says that the async client can be used for synchronous calls by setting use.async.http.conduit bus property to true. This also specifically refers to NTLM authentication.

Dave G
  • 9,639
  • 36
  • 41
  • ah! I see * -hc (httpclient). Any idea how to access "HttpClient" instance CXF would use behind the scenes? – Stackee007 Jun 26 '17 at 19:55
  • Does CXF uses HttpClient for async web services only? – Stackee007 Jun 26 '17 at 19:59
  • I'm checking that now - I'm not 100% sure of the transport mech at the moment. – Dave G Jun 26 '17 at 20:00
  • I've unfortunately led you into a very complex area of the CXF runtime. The HTTP Client functionality is provided as a Conduit. This is kind of an interceptor around a particular soap port. That said, you may have to slog through some source code: https://github.com/apache/cxf/blob/3.1.x-fixes/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java. As for getting the actual HttpClient, that is stored as an attribute on the Conduit implementation which you /may/ be able to reach from an interceptor. – Dave G Jun 26 '17 at 20:08
  • I have already read CXF async and NTLM docs, unfortunately my requirements are not for async services – Stackee007 Jun 27 '17 at 16:34
  • As I tried to state, this can be used for synchronous requests even though the underlying handler is asynchronous – Dave G Jun 27 '17 at 16:56