@ Override public WebTarget target ( UriBuilder builder ) { checkClosed ( ) ; WebTargetImpl wt = ( WebTargetImpl ) super . target ( builder ) ; //construct our own webclient JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean ( ) ; URI uri = builder . build ( ) ; bean . setAddress ( uri . toString ( ) ) ; WebClient targetClient = bean . createWebClient ( ) ; //get ClientCongfiguration ClientConfiguration ccfg = WebClient . getConfig ( targetClient ) ; //add Liberty Jax-RS Client Config Interceptor to configure things like KeepAlive, timeouts, etc. ccfg . getOutInterceptors ( ) . add ( new LibertyJaxRsClientConfigInterceptor ( Phase . PRE_LOGICAL ) ) ; //add Liberty Jax-RS Client Proxy Interceptor to configure the proxy ccfg . getOutInterceptors ( ) . add ( new LibertyJaxRsClientProxyInterceptor ( Phase . PRE_LOGICAL ) ) ; //add Liberty Ltpa handler Interceptor to check if is using ltpa token for sso ccfg . getOutInterceptors ( ) . add ( new LibertyJaxRsClientLtpaInterceptor ( ) ) ; //add Liberty Jax-RS OAuth Interceptor to check whether it has to propagate OAuth/access token ccfg . getOutInterceptors ( ) . add ( new LibertyJaxRsClientOAuthInterceptor ( ) ) ; //add Interceptor to check whether it has to propagate SAML token for sso ccfg . getOutInterceptors ( ) . add ( new PropagationHandler ( ) ) ; /** * if no any user programmed SSL context info * put the LibertyJaxRsClientSSLOutInterceptor into client OUT interceptor chain * see if Liberty SSL can help */ if ( hasSSLConfigInfo == false ) { LibertyJaxRsClientSSLOutInterceptor sslOutInterceptor = new LibertyJaxRsClientSSLOutInterceptor ( Phase . PRE_LOGICAL ) ; sslOutInterceptor . setTLSConfiguration ( secConfig ) ; ccfg . getOutInterceptors ( ) . add ( sslOutInterceptor ) ; } //set bus LibertyApplicationBus bus ; //202957 same url use same bus, add a lock to busCache to ensure only one bus will be created in concurrent mode. //ConcurrentHashMap can't ensure that. String moduleName = getModuleName ( ) ; String id = moduleName + uri . getHost ( ) + "-" + uri . getPort ( ) ; synchronized ( busCache ) { bus = busCache . get ( id ) ; if ( bus == null ) { bus = LibertyJAXRSClientBusFactory . getInstance ( ) . getClientScopeBus ( id ) ; busCache . put ( id , bus ) ; } } ccfg . setBus ( bus ) ; //add the root WebTarget to managed set so we can close it's associated WebClient synchronized ( baseClients ) { baseClients . add ( targetClient ) ; } return new WebTargetImpl ( wt . getUriBuilder ( ) , wt . getConfiguration ( ) , targetClient ) ; }
override this method then put our webclient into cxf client API