Examples of JAXRSClientFactoryBean


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

    }

    @SuppressWarnings("unchecked")
    protected void invokeHttpClient(Exchange exchange) throws Exception {
        Message inMessage = exchange.getIn();
        JAXRSClientFactoryBean cfb = clientFactoryBeanCache.get(CxfEndpointUtils
            .getEffectiveAddress(exchange, ((CxfRsEndpoint)getEndpoint()).getAddress()));
        Bus bus = ((CxfRsEndpoint)getEndpoint()).getBus();
        // We need to apply the bus setting from the CxfRsEndpoint which is not use the default bus
        if (bus != null) {
            cfb.setBus(bus);
        }
        WebClient client = cfb.createWebClient();
        String httpMethod = inMessage.getHeader(Exchange.HTTP_METHOD, String.class);
        Class<?> responseClass = inMessage.getHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS, Class.class);
        Type genericType = inMessage.getHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_GENERIC_TYPE, Type.class);
        String path = inMessage.getHeader(Exchange.HTTP_PATH, String.class);
View Full Code Here

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

        Message inMessage = exchange.getIn();
        Object[] varValues = inMessage.getHeader(CxfConstants.CAMEL_CXF_RS_VAR_VALUES, Object[].class);
        String methodName = inMessage.getHeader(CxfConstants.OPERATION_NAME, String.class);
        Client target = null;
       
        JAXRSClientFactoryBean cfb = clientFactoryBeanCache.get(CxfEndpointUtils
                                   .getEffectiveAddress(exchange, ((CxfRsEndpoint)getEndpoint()).getAddress()));
        Bus bus = ((CxfRsEndpoint)getEndpoint()).getBus();
        // We need to apply the bus setting from the CxfRsEndpoint which is not use the default bus
        if (bus != null) {
            cfb.setBus(bus);
        }
        if (varValues == null) {
            target = cfb.create();
        } else {
            target = cfb.createWithValues(varValues);
        }
        // find out the method which we want to invoke
        JAXRSServiceFactoryBean sfb = cfb.getServiceFactory();
        sfb.getResourceClasses();
        // check the null body first
        Object[] parameters = null;
        if (inMessage.getBody() != null) {
            parameters = inMessage.getBody(Object[].class);
View Full Code Here

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

    public void testCxfBusInjection() {

        CxfRsEndpoint serviceEndpoint = context.getEndpoint("cxfrs:bean:serviceEndpoint", CxfRsEndpoint.class);
        CxfRsEndpoint routerEndpoint = context.getEndpoint("cxfrs:bean:routerEndpoint", CxfRsEndpoint.class);
        JAXRSServerFactoryBean server = routerEndpoint.createJAXRSServerFactoryBean();
        JAXRSClientFactoryBean client = serviceEndpoint.createJAXRSClientFactoryBean();
        assertEquals("These cxfrs endpoints don't share the same bus", server.getBus().getId(), client.getBus().getId());
    }
View Full Code Here

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

    protected JAXRSServerFactoryBean newJAXRSServerFactoryBean() {
        return new JAXRSServerFactoryBean();
    }
   
    protected JAXRSClientFactoryBean newJAXRSClientFactoryBean() {
        return new JAXRSClientFactoryBean();
    }
View Full Code Here

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

    public JAXRSClientFactoryBean createJAXRSClientFactoryBean() {
        return createJAXRSClientFactoryBean(getAddress());
    }
   
    public JAXRSClientFactoryBean createJAXRSClientFactoryBean(String address) {
        JAXRSClientFactoryBean answer = newJAXRSClientFactoryBean();
        setupJAXRSClientFactoryBean(answer, address);
        return answer;
    }
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 testEmptyPostProxy2() 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.emptypostNoPath();
        assertEquals(204, WebClient.client(store).getResponse().getStatus());
    }
View Full Code Here

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

        }
       
        private void initTargetClientIfNeeded() {
            URI uri = uriBuilder.build();
            if (targetClient == null) {
                JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
                bean.setAddress(uri.toString());
                targetClient = bean.createWebClient();
                ClientImpl.this.baseClients.add(targetClient);
            } else if (!targetClient.getCurrentURI().equals(uri)) {
                targetClient.to(uri.toString(), false);
            }
        }
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.