/** * Creates a proxy * @param baseAddress baseAddress * @param cls proxy class, if not interface then a CGLIB proxy will be created * @param providers list of providers * @param configLocation classpath location of the configuration resource * @return typed proxy */ public static <T> T create(String baseAddress, Class<T> cls, List<?> providers, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, cls, configLocation); bean.setProviders(providers); return bean.create(cls); }
/** * 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 * @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 a proxy * @param baseAddress baseAddress * @param cls proxy class, if not interface then a CGLIB proxy will be created * @param providers list of providers * @param configLocation classpath location of the configuration resource * @return typed proxy */ public static <T> T create(String baseAddress, Class<T> cls, List<?> providers, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, cls, configLocation); bean.setProviders(providers); return bean.create(cls); }
/** * 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 a proxy * @param baseAddress baseAddress * @param cls proxy class, if not interface then a CGLIB proxy will be created * @param providers list of providers * @param configLocation classpath location of the configuration resource * @return typed proxy */ public static <T> T create(String baseAddress, Class<T> cls, List<?> providers, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, cls, configLocation); bean.setProviders(providers); return bean.create(cls); }
/** * 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(); }
@Override protected void setJaxrsResources(JAXRSClientFactoryBean factory) { factory.setServiceClass(WebClient.class); if (!StringUtils.isEmpty(scanPackages)) { try { final Map< Class< ? extends Annotation >, Collection< Class< ? > > > classes = ClasspathScanner.findClasses(scanPackages, Provider.class); factory.setProviders( JAXRSClientFactoryBeanDefinitionParser.getProviders(context, classes.get(Provider.class))); } catch (Exception ex) { throw new ServiceConstructionException(ex); } } }
@Override protected void setJaxrsResources(JAXRSClientFactoryBean factory) { factory.setServiceClass(WebClient.class); if (!StringUtils.isEmpty(scanPackages)) { try { final Map< Class< ? extends Annotation >, Collection< Class< ? > > > classes = ClasspathScanner.findClasses(scanPackages, Provider.class); factory.setProviders( JAXRSClientFactoryBeanDefinitionParser.getProviders(context, classes.get(Provider.class))); } catch (Exception ex) { throw new ServiceConstructionException(ex); } } }
/** * 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 proxy and allows to specify time to keep state. * @param baseAddress baseAddress * @param cls proxy class, if not interface then a CGLIB proxy will be created * @param providers list of providers * @param timeToKeepState how long to keep this state * @return typed proxy */ public static <T> T create(String baseAddress, Class<T> cls, List<?> providers, long timeToKeepState) { JAXRSClientFactoryBean bean = getBean(baseAddress, cls, null); bean.setProviders(providers); bean.setInitialState(new ThreadLocalClientState(baseAddress, timeToKeepState)); return bean.create(cls); }
/** * Creates WebClient * @param baseAddress baseURI * @param providers list of providers * @param threadSafe if true ThreadLocalClientState is used */ public static WebClient create(String baseAddress, List<?> providers, boolean threadSafe) { JAXRSClientFactoryBean bean = getBean(baseAddress, null); bean.setProviders(providers); if (threadSafe) { bean.setInitialState(new ThreadLocalClientState(baseAddress)); } return bean.createWebClient(); }
/** * Creates a thread safe proxy and allows to specify time to keep state. * @param baseAddress baseAddress * @param cls proxy class, if not interface then a CGLIB proxy will be created * @param providers list of providers * @param timeToKeepState how long to keep this state * @return typed proxy */ public static <T> T create(String baseAddress, Class<T> cls, List<?> providers, long timeToKeepState) { JAXRSClientFactoryBean bean = getBean(baseAddress, cls, null); bean.setProviders(providers); bean.setInitialState(new ThreadLocalClientState(baseAddress, timeToKeepState)); return bean.create(cls); }
/** * Creates WebClient * @param baseURI baseURI * @param providers list of providers */ public static WebClient create(String baseAddress, List<?> providers, boolean threadSafe) { JAXRSClientFactoryBean bean = getBean(baseAddress, null); bean.setProviders(providers); if (threadSafe) { bean.setInitialState(new ThreadLocalClientState(baseAddress)); } 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(); }
/** * Creates a thread safe proxy * @param baseAddress baseAddress * @param cls proxy class, if not interface then a CGLIB proxy will be created * @param providers list of providers * @param threadSafe if true then a thread-safe proxy will be created * @return typed proxy */ public static <T> T create(String baseAddress, Class<T> cls, List<?> providers, boolean threadSafe) { JAXRSClientFactoryBean bean = getBean(baseAddress, cls, null); bean.setProviders(providers); if (threadSafe) { bean.setInitialState(new ThreadLocalClientState(baseAddress)); } return bean.create(cls); }
/** * Creates WebClient * @param baseAddress baseURI * @param providers list of providers * @param threadSafe if true ThreadLocalClientState is used */ public static WebClient create(String baseAddress, List<?> providers, boolean threadSafe) { JAXRSClientFactoryBean bean = getBean(baseAddress, null); bean.setProviders(providers); if (threadSafe) { bean.setInitialState(new ThreadLocalClientState(baseAddress)); } return bean.createWebClient(); }
/** * Creates a proxy using user resource model * @param baseAddress baseAddress * @param cls proxy class, if not interface then a CGLIB proxy will be created * @param modelRef model location * @param providers list of providers * @param configLocation classpath location of the configuration resource * @return typed proxy */ public static <T> T createFromModel(String baseAddress, Class<T> cls, String modelRef, List<?> providers, String configLocation) { JAXRSClientFactoryBean bean = WebClient.getBean(baseAddress, configLocation); bean.setProviders(providers); bean.setModelRef(modelRef); bean.setServiceClass(cls); return bean.create(cls); }
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);
private BookStore createBookStore(String address, String propLoc) throws Exception { JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); SpringBusFactory bf = new SpringBusFactory(); URL busFile = JAXRSJweJsonTest.class.getResource("client.xml"); Bus springBus = bf.createBus(busFile.toString()); bean.setBus(springBus); bean.setServiceClass(BookStore.class); bean.setAddress(address); List<Object> providers = new LinkedList<>(); JweJsonWriterInterceptor writer = new JweJsonWriterInterceptor(); providers.add(writer); providers.add(new JweJsonClientResponseFilter()); bean.setProviders(providers); bean.getProperties(true).put(JoseConstants.RSSEC_ENCRYPTION_PROPS, propLoc); return bean.create(BookStore.class); }