/** * Creates WebClient * @param baseAddress baseAddress * @param configLocation classpath location of the configuration resource, can be null * @return WebClient instance */ public static WebClient create(String baseAddress, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, configLocation); return bean.createWebClient(); }
/** * Creates WebClient * @param baseAddress baseAddress * @param configLocation classpath location of the configuration resource, can be null * @return WebClient instance */ public static WebClient create(String baseAddress, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, configLocation); return bean.createWebClient(); }
/** * Create a Client instance. Proxies and WebClients are Clients. * @return the client */ public Client create() { if (serviceClass == WebClient.class) { return createWebClient(); } return createWithValues(); }
/** * Creates WebClient * @param baseAddress baseAddress * @param configLocation classpath location of the configuration resource, can be null * @return WebClient instance */ public static WebClient create(String baseAddress, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, configLocation); return bean.createWebClient(); }
protected WebClient getWebClient() { if (null == cachedClient) { cachedClient = getClientFactory().createWebClient(); } return cachedClient; }
/** * Create a Client instance. Proxies and WebClients are Clients. * @return the client */ public Client create() { if (serviceClass == WebClient.class) { return createWebClient(); } return createWithValues(); }
/** * Creates WebClient * @param baseAddress baseAddress * @param providers list of providers * @param configLocation classpath location of the configuration resource, can be null * @return WebClient instance */ public static WebClient create(String baseAddress, List<?> providers, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, configLocation); bean.setProviders(providers); return bean.createWebClient(); }
/** * Creates WebClient * @param baseAddress baseAddress */ public static WebClient create(String baseAddress) { JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); bean.setAddress(baseAddress); return bean.createWebClient(); }
/** * Creates WebClient * @param baseAddress baseAddress */ public static WebClient create(String baseAddress) { JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); bean.setAddress(baseAddress); return bean.createWebClient(); }
/** * Creates WebClient * @param baseAddress baseAddress * @param providers list of providers * @param configLocation classpath location of the configuration resource, can be null * @return WebClient instance */ public static WebClient create(String baseAddress, List<?> providers, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, configLocation); bean.setProviders(providers); return bean.createWebClient(); }
protected WebClient getWebClient(String address, FailoverFeature feature) throws Exception { JAXRSClientFactoryBean bean = createBean(address, feature); return bean.createWebClient(); }
/** * Creates a thread safe WebClient * @param baseAddress baseURI * @param providers list of providers * @param timeToKeepState time to keep this thread safe state. */ public static WebClient create(String baseAddress, List<?> providers, long timeToKeepState) { JAXRSClientFactoryBean bean = getBean(baseAddress, null); bean.setProviders(providers); bean.setInitialState(new ThreadLocalClientState(baseAddress, timeToKeepState)); return bean.createWebClient(); }
/** * Creates a thread safe WebClient * @param baseAddress baseURI * @param providers list of providers * @param timeToKeepState time to keep this thread safe state. */ public static WebClient create(String baseAddress, List<?> providers, long timeToKeepState) { JAXRSClientFactoryBean bean = getBean(baseAddress, null); bean.setProviders(providers); bean.setInitialState(new ThreadLocalClientState(baseAddress, timeToKeepState)); return bean.createWebClient(); }
/** * Creates a thread safe WebClient * @param baseURI baseURI * @param providers list of providers * @param timeToKeepState time to keep this thread safe state. */ public static WebClient create(String baseAddress, List<?> providers, long timeToKeepState) { JAXRSClientFactoryBean bean = getBean(baseAddress, null); bean.setProviders(providers); bean.setInitialState(new ThreadLocalClientState(baseAddress, timeToKeepState)); return bean.createWebClient(); }
private WebClient createClient(String address, String username, String password) { JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); bean.setAddress(address); bean.setUsername(username); bean.setPassword(password); bean.getOutInterceptors().add(new LoggingOutInterceptor()); bean.getInInterceptors().add(new LoggingInInterceptor()); WebClient wc = bean.createWebClient(); WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(1000000L); return wc; }
private WebClient createRsWebClient(String address, ClientAccessToken at, String clientContext) { JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); bean.setAddress(address); SpringBusFactory bf = new SpringBusFactory(); URL busFile = JAXRSOAuth2TlsTest.class.getResource(clientContext); Bus springBus = bf.createBus(busFile.toString()); bean.setBus(springBus); WebClient wc = bean.createWebClient(); wc.accept(MediaType.APPLICATION_XML); wc.authorization(at); return wc; }
private WebClient createWebClient(String address) { JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); bean.setAddress(address); SpringBusFactory bf = new SpringBusFactory(); URL busFile = JAXRSOAuth2Test.class.getResource("client.xml"); Bus springBus = bf.createBus(busFile.toString()); bean.setBus(springBus); WebClient wc = bean.createWebClient(); wc.type(MediaType.APPLICATION_FORM_URLENCODED).accept(MediaType.APPLICATION_JSON); return wc; }
private WebClient createOAuth2WebClient(String address) { JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); bean.setAddress(address); SpringBusFactory bf = new SpringBusFactory(); URL busFile = JAXRSOAuth2TlsTest.class.getResource("client.xml"); Bus springBus = bf.createBus(busFile.toString()); bean.setBus(springBus); WebClient wc = bean.createWebClient(); wc.type(MediaType.APPLICATION_FORM_URLENCODED).accept(MediaType.APPLICATION_JSON); return wc; } private WebClient createDynRegWebClient(String address) {
@Test public void testOtherInterceptorDrainingStream() throws Exception { String baseAddress = "http://localhost:" + PORT + "/test/services/rest"; JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); bean.setAddress(baseAddress); bean.getInInterceptors().add(new TestStreamDrainInterptor()); WebClient client = bean.createWebClient(); client.path("/bookstore/123").accept(MediaType.APPLICATION_XML_TYPE); Book b = client.get(Book.class); assertEquals(123, b.getId()); assertEquals("CXF in Action", b.getName()); }
@Test public void testGetBook123UserModelAuthorize() throws Exception { JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); bean.setAddress("http://localhost:" + PORT + "/usermodel/bookstore/books"); bean.setUsername("Barry"); bean.setPassword("password"); bean.setModelRef("classpath:org/apache/cxf/systest/jaxrs/resources/resources.xml"); WebClient proxy = bean.createWebClient(); proxy.path("{id}/authorize", 123); Book book = proxy.get(Book.class); assertEquals(123L, book.getId()); }