JAXRSClientFactoryBean sf = new JAXRSClientFactoryBean(); sf.setResourceClass(serviceClass); sf.setAddress("http://" + getServerUrl() + "/cxf/" + serviceName); sf.setProviders(providers); ConduitInitiatorManager cim = sf.getBus().getExtension(ConduitInitiatorManager.class); cim.registerConduitInitiator("http://cxf.apache.org/transports/http", new HTTPTransportFactory(sf.getBus())); service = sf.create(serviceClass);
protected void applyFeatures(AbstractClient client) { if (getFeatures() != null) { getFeatures().forEach(feature -> { feature.initialize(client.getConfiguration(), getBus()); }); } }
protected void applyFeatures(AbstractClient client) { if (getFeatures() != null) { getFeatures().forEach(feature -> { feature.initialize(client.getConfiguration(), getBus()); }); } }
protected void applyFeatures(AbstractClient client) { if (getFeatures() != null) { for (Feature feature : getFeatures()) { feature.initialize(client.getConfiguration(), getBus()); } } }
serviceFactory.setBus(getBus()); checkResources(false); ClassResourceInfo cri = null;
serviceFactory.setBus(getBus()); checkResources(false); ClassResourceInfo cri = null;
serviceFactory.setBus(getBus()); checkResources(false); ClassResourceInfo cri = null;
protected JAXRSClientFactoryBean getClientFactory() { if (null == cachedClientFactory) { JAXRSClientFactoryBean factoryBean = new JAXRSClientFactoryBean(); factoryBean.setThreadSafe(true); factoryBean.setAddress(getServerURL()); if (Authentication.BASIC == auxiliaryStorageAuthentication) { factoryBean.setUsername(authenticationUser); factoryBean.setPassword(authenticationPassword); } if (Authentication.SAML == auxiliaryStorageAuthentication) { STSClient stsClient = STSClientCreator.create(factoryBean.getBus(), stsProps); STSRESTOutInterceptor outInterceptor = new STSRESTOutInterceptor(); outInterceptor.setStsClient(stsClient); factoryBean.getOutInterceptors().add(outInterceptor); factoryBean.getOutInterceptors().add(new SamlHeaderOutInterceptor()); } cachedClientFactory = factoryBean; } return cachedClientFactory; }
protected JAXRSClientFactoryBean getClientFactory() { if (null == cachedClientFactory) { JAXRSClientFactoryBean factoryBean = new JAXRSClientFactoryBean(); factoryBean.setThreadSafe(true); factoryBean.setAddress(getServerURL()); if (Authentication.BASIC == auxiliaryStorageAuthentication) { factoryBean.setUsername(authenticationUser); factoryBean.setPassword(authenticationPassword); } if (Authentication.SAML == auxiliaryStorageAuthentication) { STSClient stsClient = STSClientCreator.create(factoryBean.getBus(), stsProps); STSRESTOutInterceptor outInterceptor = new STSRESTOutInterceptor(); outInterceptor.setStsClient(stsClient); factoryBean.getOutInterceptors().add(outInterceptor); factoryBean.getOutInterceptors().add(new SamlHeaderOutInterceptor()); } cachedClientFactory = factoryBean; } return cachedClientFactory; }
client.getConfiguration().setBus(getBus()); client.getConfiguration().getOutInterceptors().addAll(getOutInterceptors()); client.getConfiguration().getOutInterceptors().addAll(ep.getOutInterceptors()); client.headers(headers); ClientProviderFactory factory = ClientProviderFactory.createInstance(getBus()); setupFactory(factory, ep);
client.getConfiguration().setBus(getBus()); client.getConfiguration().getOutInterceptors().addAll(getOutInterceptors()); client.getConfiguration().getOutInterceptors().addAll(ep.getOutInterceptors()); client.headers(headers); ClientProviderFactory factory = ClientProviderFactory.createInstance(getBus()); setupFactory(factory, ep);
client.getConfiguration().setBus(getBus()); client.getConfiguration().getOutInterceptors().addAll(getOutInterceptors()); client.getConfiguration().getOutInterceptors().addAll(ep.getOutInterceptors());
private void doTestGetBook123ProxyFromSpring(String cfgFile) throws Exception { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] {cfgFile}); Object bean = ctx.getBean("bookService.proxyFactory"); assertNotNull(bean); JAXRSClientFactoryBean cfb = (JAXRSClientFactoryBean) bean; Bus bus = cfb.getBus(); ClientLifeCycleManager manager = bus.getExtension(ClientLifeCycleManager.class); TestClientLifeCycleListener listener = new TestClientLifeCycleListener(); manager.registerListener(listener); BookStore bs = cfb.create(BookStore.class); assertNotNull(listener.getEp()); assertEquals("{http://service.rs}BookService", listener.getEp().getEndpointInfo().getName().toString()); assertEquals("https://localhost:" + PORT, WebClient.client(bs).getBaseURI().toString()); Book b = bs.getSecureBook("123"); assertEquals(b.getId(), 123); b = bs.getSecureBook("123"); assertEquals(b.getId(), 123); ctx.close(); }