Examples of JAXRSServiceFactoryBean


Examples of org.apache.cxf.jaxrs.JAXRSServiceFactoryBean

        }
       
        setupClientHeaders(target, exchange);
       
        // 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);
        }
        // get the method
        Method method = findRightMethod(sfb.getResourceClasses(), methodName, getParameterTypes(parameters));
        // Will send out the message to
        // Need to deal with the sub resource class
        Object response = method.invoke(target, parameters);
        int statesCode = target.getResponse().getStatus();
        if (throwException) {
View Full Code Here

Examples of org.apache.cxf.jaxrs.JAXRSServiceFactoryBean

            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);
        }
        // get the method
        Method method = findRightMethod(sfb.getResourceClasses(), methodName, getParameterTypes(parameters));
        // Will send out the message to
        // Need to deal with the sub resource class
        Object response = method.invoke(target, parameters);
        int statesCode = target.getResponse().getStatus();
        if (throwException) {
View Full Code Here

Examples of org.apache.cxf.jaxrs.JAXRSServiceFactoryBean

    private long timeToKeepState;
    private Class<?> serviceClass;
    private ClassLoader proxyLoader;
   
    public JAXRSClientFactoryBean() {
        this(new JAXRSServiceFactoryBean());
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.JAXRSServiceFactoryBean

        assertEquals("3", list.get(1));
    }
   
    @Test
    public void testSelectBetweenMultipleResourceClasses() throws Exception {
        JAXRSServiceFactoryBean sf = new JAXRSServiceFactoryBean();
        sf.setResourceClasses(org.apache.cxf.jaxrs.resources.BookStoreNoSubResource.class,
                              org.apache.cxf.jaxrs.resources.BookStore.class);
        sf.create();       
        List<ClassResourceInfo> resources = ((JAXRSServiceImpl)sf.getService()).getClassResourceInfos();
        MultivaluedMap<String, String> map = new MetadataMap<String, String>();
        ClassResourceInfo bStore = JAXRSUtils.selectResourceClass(resources, "/bookstore", map, null);
        assertEquals(bStore.getResourceClass(), org.apache.cxf.jaxrs.resources.BookStore.class);
       
        bStore = JAXRSUtils.selectResourceClass(resources, "/bookstore/", map, null);
View Full Code Here

Examples of org.apache.cxf.jaxrs.JAXRSServiceFactoryBean

        invoker.invoke(exc, Collections.emptyList(), customer);
    }
   
    @Test
    public void testSelectBetweenMultipleResourceClasses2() throws Exception {
        JAXRSServiceFactoryBean sf = new JAXRSServiceFactoryBean();
        sf.setResourceClasses(org.apache.cxf.jaxrs.resources.TestResourceTemplate1.class,
                              org.apache.cxf.jaxrs.resources.TestResourceTemplate2.class);
        sf.create();       
        List<ClassResourceInfo> resources = ((JAXRSServiceImpl)sf.getService()).getClassResourceInfos();
        MultivaluedMap<String, String> map = new MetadataMap<String, String>();
        ClassResourceInfo bStore = JAXRSUtils.selectResourceClass(resources, "/1", map, null);
        assertEquals(bStore.getResourceClass(), org.apache.cxf.jaxrs.resources.TestResourceTemplate1.class);
       
        bStore = JAXRSUtils.selectResourceClass(resources, "/1/", map, null);
View Full Code Here

Examples of org.apache.cxf.jaxrs.JAXRSServiceFactoryBean

                     org.apache.cxf.jaxrs.resources.TestResourceTemplate2.class);
    }
   
    @Test
    public void testSelectBetweenMultipleResourceClasses3() throws Exception {
        JAXRSServiceFactoryBean sf = new JAXRSServiceFactoryBean();
        sf.setResourceClasses(org.apache.cxf.jaxrs.resources.TestResourceTemplate4.class,
                              org.apache.cxf.jaxrs.resources.TestResourceTemplate3.class);
        sf.create();       
        List<ClassResourceInfo> resources = ((JAXRSServiceImpl)sf.getService()).getClassResourceInfos();
        MultivaluedMap<String, String> map = new MetadataMap<String, String>();
        ClassResourceInfo bStore = JAXRSUtils.selectResourceClass(resources, "/", map, null);
        assertEquals(bStore.getResourceClass(), org.apache.cxf.jaxrs.resources.TestResourceTemplate3.class);
       
        bStore = JAXRSUtils.selectResourceClass(resources, "/test", map, null);
View Full Code Here

Examples of org.apache.cxf.jaxrs.JAXRSServiceFactoryBean

       
    }
   
    @Test
    public void testFindTargetResourceClass() throws Exception {
        JAXRSServiceFactoryBean sf = new JAXRSServiceFactoryBean();
        sf.setResourceClasses(org.apache.cxf.jaxrs.resources.BookStoreNoSubResource.class);
        sf.create();       
        List<ClassResourceInfo> resources = ((JAXRSServiceImpl)sf.getService()).getClassResourceInfos();

        String contentTypes = "*/*";
       
        //If acceptContentTypes does not specify a specific Mime type, the 
        //method is declared with a most specific ProduceMime type is selected.
View Full Code Here

Examples of org.apache.cxf.jaxrs.JAXRSServiceFactoryBean

        return JAXRSUtils.parseMediaTypes(types);
    }
   
    @Test
    public void testFindTargetResourceClassWithTemplates() throws Exception {
        JAXRSServiceFactoryBean sf = new JAXRSServiceFactoryBean();
        sf.setResourceClasses(org.apache.cxf.jaxrs.resources.BookStoreTemplates.class);
        sf.create();       
        List<ClassResourceInfo> resources = ((JAXRSServiceImpl)sf.getService()).getClassResourceInfos();

        String contentTypes = "*/*";
       
        //If acceptContentTypes does not specify a specific Mime type, the 
        //method is declared with a most specific ProduceMime type is selected.
View Full Code Here

Examples of org.apache.cxf.jaxrs.JAXRSServiceFactoryBean

        assertEquals("Only the first {id} should've been picked up", "4", values.getFirst("bookId"));
    }
   
    @Test
    public void testFindTargetResourceClassWithSubResource() throws Exception {
        JAXRSServiceFactoryBean sf = new JAXRSServiceFactoryBean();
        sf.setResourceClasses(org.apache.cxf.jaxrs.resources.BookStore.class);
        sf.create();       
        List<ClassResourceInfo> resources = ((JAXRSServiceImpl)sf.getService()).getClassResourceInfos();

        String contentTypes = "*/*";
       
        OperationResourceInfo ori = findTargetResourceClass(resources,
               null, "/bookstore/books/123", "GET", new MetadataMap<String, String>(), contentTypes,
View Full Code Here

Examples of org.apache.cxf.jaxrs.JAXRSServiceFactoryBean

    private long timeToKeepState;
    private Class serviceClass;
    private ClassLoader proxyLoader;
   
    public JAXRSClientFactoryBean() {
        this(new JAXRSServiceFactoryBean());
    }
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.