Examples of JAXRSClientFactoryBean


Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

                                                               new CustomGrant());
        assertNotNull(at.getTokenKey());
    }
   
    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;
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

   
    @Test
    public void testInvalidSAMLTokenAsHeader() throws Exception {
        String address = "https://localhost:" + PORT + "/samlheader/bookstore/books/123";
       
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setAddress(address);
       
        SpringBusFactory bf = new SpringBusFactory();
        URL busFile = JAXRSSamlTest.class.getResource("client.xml");
        Bus springBus = bf.createBus(busFile.toString());
        bean.setBus(springBus);

        WebClient wc = bean.createWebClient();
        wc.header("Authorization", "SAML invalid_grant");
        Response r = wc.get();
        assertEquals(401, r.getStatus());
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

        wc.type(MediaType.APPLICATION_FORM_URLENCODED).accept(MediaType.APPLICATION_JSON);
        return wc;
    }
   
    private WebClient createWebClientWithProps(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);

        Map<String, Object> properties = new HashMap<String, Object>();
        properties.put("ws-security.callback-handler",
                       "org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
        properties.put("ws-security.saml-callback-handler",
                       "org.apache.cxf.systest.jaxrs.security.oauth2.SamlCallbackHandler2");
        properties.put("ws-security.signature.username", "alice");
        properties.put("ws-security.signature.properties", CRYPTO_RESOURCE_PROPERTIES);
        properties.put("ws-security.self-sign-saml-assertion", "true");
        bean.setProperties(properties);
       
        bean.getOutInterceptors().add(new Saml2BearerAuthOutInterceptor());
       
        WebClient wc = bean.createWebClient();
        wc.type(MediaType.APPLICATION_FORM_URLENCODED).accept(MediaType.APPLICATION_JSON);
        return wc;
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

   
    private WebClient createWebClient(String address,
                                      Interceptor<Message> outInterceptor,
                                      Object provider,
                                      boolean selfSign) {
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setAddress(address);
       
        SpringBusFactory bf = new SpringBusFactory();
        URL busFile = JAXRSSamlTest.class.getResource("client.xml");
        Bus springBus = bf.createBus(busFile.toString());
        bean.setBus(springBus);

        Map<String, Object> properties = new HashMap<String, Object>();
        properties.put("ws-security.callback-handler",
                       "org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
        properties.put("ws-security.saml-callback-handler",
                       "org.apache.cxf.systest.jaxrs.security.saml.SamlCallbackHandler");
        properties.put("ws-security.signature.username", "alice");
        properties.put("ws-security.signature.properties",
                       "org/apache/cxf/systest/jaxrs/security/alice.properties");
        if (selfSign) {
            properties.put("ws-security.self-sign-saml-assertion", "true");
        }
        bean.setProperties(properties);
       
        bean.getOutInterceptors().add(outInterceptor);
        if (provider != null) {
            bean.setProvider(provider);
        }
        return bean.createWebClient();
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

    }
   
    private WebClient createWebClientForExistingToken(String address,
                                      Interceptor<Message> outInterceptor,
                                      Object provider) {
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setAddress(address);
       
        SpringBusFactory bf = new SpringBusFactory();
        URL busFile = JAXRSSamlTest.class.getResource("client.xml");
        Bus springBus = bf.createBus(busFile.toString());
        bean.setBus(springBus);

        bean.getOutInterceptors().add(outInterceptor);
        bean.getOutInterceptors().add(new SamlRetrievalInterceptor());
        if (provider != null) {
            bean.setProvider(provider);
        }
        return bean.createWebClient();
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

        return feature;
    }
   
    protected BookStore getBookStore(String address,
                                     FailoverFeature feature) throws Exception {
        JAXRSClientFactoryBean bean = createBean(address, feature);
        bean.setServiceClass(BookStore.class);
        return bean.create(BookStore.class);
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

        return bean.create(BookStore.class);
    }
   
    protected WebClient getWebClient(String address,
                                     FailoverFeature feature) throws Exception {
        JAXRSClientFactoryBean bean = createBean(address, feature);
       
        return bean.createWebClient();
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

        return bean.createWebClient();
    }
   
    protected JAXRSClientFactoryBean createBean(String address,
                                                FailoverFeature feature) {
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setAddress(address);
        List<Feature> features = new ArrayList<Feature>();
        features.add(feature);
        bean.setFeatures(features);
       
        return bean;
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

    }
   
    @Test
    public void testEmptyPostProxy() throws Exception {
        String address = "http://localhost:" + PORT;
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setAddress(address);
        bean.setResourceClass(BookStore.class);
        BookStore store = bean.create(BookStore.class);
        store.emptypost();
        assertEquals(204, WebClient.client(store).getResponse().getStatus());
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

    }
   
    @Test
    public void testGetStringArray() throws Exception {
        String address = "http://localhost:" + PORT;
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setProvider(new BookStore.StringArrayBodyReaderWriter());
        bean.setAddress(address);
        bean.setResourceClass(BookStore.class);
        BookStore store = bean.create(BookStore.class);
        String[] str = store.getBookStringArray();
        assertEquals("Good book", str[0]);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.