Examples of JAXBElementProvider


Examples of org.apache.cxf.jaxrs.provider.JAXBElementProvider

    }
   
    @Test
    public void testPostBookXsiTypeProxy() throws Exception {
        String address = "http://localhost:" + PORT + "/the/thebooksxsi/bookstore";
        JAXBElementProvider provider = new JAXBElementProvider();
        provider.setExtraClass(new Class[]{SuperBook.class});
        provider.setJaxbElementClassNames(Collections.singletonList(Book.class.getName()));
        BookStoreSpring bookStore = JAXRSClientFactory.create(address, BookStoreSpring.class,
                                                              Collections.singletonList(provider));
        SuperBook book = new SuperBook("SuperBook2", 999L);
        Book book2 = bookStore.postGetBookXsiType(book);
        assertEquals("SuperBook2", book2.getName());
View Full Code Here

Examples of org.apache.cxf.jaxrs.provider.JAXBElementProvider

        p.setProduceMediaTypes(Collections.singletonList("application/bar"));
        p.setEnableBuffering(true);
        providers.add(p);
        providers.add(new BookStore.StringArrayBodyReaderWriter());
        providers.add(new BookStore.StringListBodyReaderWriter());
        JAXBElementProvider jaxbProvider = new JAXBElementProvider();
        Map<String, String> jaxbElementClassMap = new HashMap<String, String>();
        jaxbElementClassMap.put(BookNoXmlRootElement.class.getName(), "BookNoXmlRootElement");
        jaxbProvider.setJaxbElementClassMap(jaxbElementClassMap);
        providers.add(jaxbProvider);
        providers.add(new FormatResponseHandler());
        providers.add(new GenericHandlerWriter());
        providers.add(new FaultyRequestHandler());
        sf.setProviders(providers);
View Full Code Here

Examples of org.apache.cxf.jaxrs.provider.JAXBElementProvider

            XMLName name = AnnotationUtils.getAnnotation(anns, XMLName.class);
            if (name != null) {
                types.getCollectionMap().put(type, JAXRSUtils.convertStringToQName(name.value()));
            }
        }
        JAXBElementProvider provider = new JAXBElementProvider();
        if (type != null
            && !InjectionUtils.isPrimitive(type)
            && !JAXBElement.class.isAssignableFrom(type)
            && provider.isReadable(type, type, new Annotation[0], MediaType.APPLICATION_XML_TYPE)) {
            types.getAllTypes().put(type, type);
           
            Class<?> genCls = InjectionUtils.getActualType(genericType);
            if (genCls != type && genCls instanceof Class && genCls != Object.class
                && !InjectionUtils.isSupportedCollectionOrArray(genCls)) {
View Full Code Here

Examples of org.apache.cxf.jaxrs.provider.JAXBElementProvider

                               "application/xml", 200);
    }
   
    @Test
    public void testPostGetBookAdapterList() throws Exception {
        JAXBElementProvider provider = new JAXBElementProvider();
        Map<String, String> outMap = new HashMap<String, String>();
        outMap.put("Books", "CollectionWrapper");
        outMap.put("books", "Book");
        provider.setOutTransformElements(outMap);
        WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstore/books/adapter-list",
                                        Collections.singletonList(provider));
       
        Collection<? extends Book> books = wc.type("application/xml").accept("application/xml")
            .postAndGetCollection(new Books(new Book("CXF", 123L)), Book.class);
View Full Code Here

Examples of org.apache.cxf.jaxrs.provider.JAXBElementProvider

    public void testGetBookFastinfoset() throws Exception {
       
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setAddress("http://localhost:" + PORT + "/test/services/rest3/bookstore/fastinfoset2");
        bean.getInInterceptors().add(new FIStaxInInterceptor());
        JAXBElementProvider p = new JAXBElementProvider();
        p.setConsumeMediaTypes(Collections.singletonList("application/fastinfoset"));
        bean.setProvider(p);
       
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(FIStaxInInterceptor.FI_GET_SUPPORTED, Boolean.TRUE);
        bean.setProperties(props);
View Full Code Here

Examples of org.apache.cxf.jaxrs.provider.JAXBElementProvider

       
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setAddress("http://localhost:" + PORT + "/test/services/rest3/bookstore/fastinfoset");
        bean.getOutInterceptors().add(new FIStaxOutInterceptor());
        bean.getInInterceptors().add(new FIStaxInInterceptor());
        JAXBElementProvider p = new JAXBElementProvider();
        p.setConsumeMediaTypes(Collections.singletonList("application/fastinfoset"));
        p.setProduceMediaTypes(Collections.singletonList("application/fastinfoset"));
        bean.setProvider(p);
       
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(FIStaxOutInterceptor.FI_ENABLED, Boolean.TRUE);
        bean.setProperties(props);
View Full Code Here

Examples of org.apache.cxf.jaxrs.provider.JAXBElementProvider

    }
   
    @Test
    public void testPostGetBookFastinfosetProxy() throws Exception {
       
        JAXBElementProvider p = new JAXBElementProvider();
        p.setConsumeMediaTypes(Collections.singletonList("application/fastinfoset"));
        p.setProduceMediaTypes(Collections.singletonList("application/fastinfoset"));
       
        BookStoreJaxrsJaxws client = JAXRSClientFactory.create(
                                  "http://localhost:" + PORT + "/test/services/rest4",
                                  BookStoreSoapRestFastInfoset2.class,
                                  Collections.singletonList(p));
View Full Code Here

Examples of org.apache.cxf.jaxrs.provider.JAXBElementProvider

    }
   
    @Test
    public void testPostGetBookFastinfosetProxyInterceptors() throws Exception {
       
        JAXBElementProvider p = new JAXBElementProvider();
        p.setConsumeMediaTypes(Collections.singletonList("application/fastinfoset"));
        p.setProduceMediaTypes(Collections.singletonList("application/fastinfoset"));
       
        BookStoreJaxrsJaxws client = JAXRSClientFactory.create(
                                  "http://localhost:" + PORT + "/test/services/rest5",
                                  BookStoreSoapRestFastInfoset3.class,
                                  Collections.singletonList(p));
View Full Code Here

Examples of org.apache.cxf.jaxrs.provider.JAXBElementProvider

        assertEquals("CXF Rocks", b22.getName());
    }
   
    @Test
    public void testGetBookCollection2() throws Exception {
        JAXBElementProvider provider = new JAXBElementProvider();
        provider.setMarshallAsJaxbElement(true);
        provider.setUnmarshallAsJaxbElement(true);
        BookStore store = JAXRSClientFactory.create("http://localhost:" + PORT,
                                                    BookStore.class,
                                                    Collections.singletonList(provider));
        BookNoXmlRootElement b1 = new BookNoXmlRootElement("CXF in Action", 123L);
        BookNoXmlRootElement b2 = new BookNoXmlRootElement("CXF Rocks", 124L);
View Full Code Here

Examples of org.apache.cxf.jaxrs.provider.JAXBElementProvider

                               "application/xml", 200);
    }
   
    @Test
    public void testPostGetBookAdapterList() throws Exception {
        JAXBElementProvider provider = new JAXBElementProvider();
        Map<String, String> outMap = new HashMap<String, String>();
        outMap.put("Books", "CollectionWrapper");
        outMap.put("books", "Book");
        provider.setOutTransformElements(outMap);
        WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstore/books/adapter-list",
                                        Collections.singletonList(provider));
        Collection<? extends Book> books = wc.type("application/xml").accept("application/xml")
            .postAndGetCollection(new Books(new Book("CXF", 123L)), Book.class);
        assertEquals(1, books.size());
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.