You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Karnam, Jayashankar" <Ja...@in.pega.com> on 2014/03/25 15:42:08 UTC

Engaging AsyncHttpConduit and HttpAsyncClients

Hi ,

I'm using CXF 3.0 milestone release 2

I dig in the code and found  where we can set credentials ,


public InternalHttpAsyncClient(final NHttpClientConnectionManager connmgr,

            final InternalClientExec exec,

            final Lookup<CookieSpecProvider> cookieSpecRegistry,

            final Lookup<AuthSchemeProvider> authSchemeRegistry,

            final CookieStore cookieStore,

            final CredentialsProvider credentialsProvider,

            final RequestConfig defaultConfig,

            final ThreadFactory threadFactory)

I'm using this snippet to set the credentials

CXFSOAPMessageContext context = (CXFSOAPMessageContext) messageContext;
                                Dispatch<SOAPMessage> dispatch = context.getDispatch();

                                Client client = ((DispatchImpl<SOAPMessage>) dispatch).getClient();

                                HTTPConduit http = (HTTPConduit) client.getConduit();

                                AsyncHTTPConduit asynhttp = (AsyncHTTPConduit) http;

                                CloseableHttpAsyncClient htt = asynhttp.getHttpAsyncClient();

                                HttpAsyncClientBuilder def =  HttpAsyncClientBuilder.create();

                                                NHttpClientConnectionManager connManager = null;

                                                def.setConnectionManager(connManager);
                                                //Set Credentials
                                                CredentialsProvider credentialsProvider = null;

                                                def.setDefaultCredentialsProvider(credentialsProvider);
                                                //Set redirection strategy
                                                RedirectStrategy redirectStrategy = null;
                                                def.setRedirectStrategy(redirectStrategy);

                                                // Returns InternalHttpAsyncClient

                                                http = def.build();


Is this the correct approach to engage HttpConduit and the AsyncClient for NTLM Authentication?

Thanks,
Jay