Package org.apache.cxf.jaxb

Examples of org.apache.cxf.jaxb.JAXBDataBinding$CachedClassOrNull


        }
        return null;
    }
   
    private QName getPayloadElementName(Object object) {
        JAXBDataBinding dataBinding = new JAXBDataBinding();
        dataBinding.setContext(context);
        DataWriter<XMLStreamWriter> dbwriter = dataBinding.createWriter(XMLStreamWriter.class);
        StringWriter stringWriter = new StringWriter();
        XMLStreamWriter resultWriter = StaxUtils.createXMLStreamWriter(stringWriter);
        DepthXMLStreamReader reader = null;
        try {
            dbwriter.write(object, resultWriter);
View Full Code Here


                                 QName qname,
                                 Class<T> clz,
                                 JAXBContext ctx,
                                 boolean mustUnderstand) throws JAXBException {
        SoapHeader h = new SoapHeader(qname, new JAXBElement<T>(qname, clz, value),
                                      new JAXBDataBinding(ctx));
        h.setMustUnderstand(mustUnderstand);
        message.getHeaders().add(h);
    }
View Full Code Here

        AbstractServiceFactoryBean sf = null;
        try {
            DataBinding db;
            if (context != null) {
                db = new JAXBDataBinding(context);
            } else {
                db = new SourceDataBinding(type);
            }
            sf = createDispatchService(db);
        } catch (ServiceConstructionException e) {
View Full Code Here

        } catch (JAXBException jbe) {
            throw new IllegalStateException("Unable to create JAXBContext for generated packages: "
                                            + jbe.getMessage(), jbe);
        }
        
        JAXBDataBinding databinding = new JAXBDataBinding();
        databinding.setContext(context);
        svc.setDataBinding(databinding);

        ServiceInfo svcfo = client.getEndpoint().getEndpointInfo().getService();

        // Setup the new classloader!
View Full Code Here

                            + db.value().getName(), e);
                }
            }
        }
        if (retVal == null) {
            JAXBDataBinding db = new JAXBDataBinding(getQualifyWrapperSchema());
            Map props = this.getProperties();
            if (props != null && props.get("jaxb.additionalContextClasses") != null) {
                Class[] extraClass = (Class[])this.getProperties().get("jaxb.additionalContextClasses");
                db.setExtraClass(extraClass);
            }
            retVal = db;
        }
        if (retVal instanceof AbstractDataBinding && schemaLocations != null) {
            ResourceManager rr = getBus().getExtension(ResourceManager.class);
View Full Code Here

        c = ResourceUtils.createClassResourceInfo(TheBooks.class, TheBooks.class, true, true);
    }
   
    public void testJAXBWrite() throws Exception {
        Service s = new JAXRSServiceImpl(Collections.singletonList(c), true);
        DataBinding binding = new JAXBDataBinding();
        binding.initialize(s);
        DataBindingJSONProvider p = new DataBindingJSONProvider();
        p.setDataBinding(binding);
        Book b = new Book("CXF", 127L);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        p.writeTo(b, Book.class, Book.class,
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void testJAXBRead() throws Exception {
        String data = "{\"Book\":{\"id\":127,\"name\":\"CXF\",\"state\":\"\"}}";
        Service s = new JAXRSServiceImpl(Collections.singletonList(c), true);
        DataBinding binding = new JAXBDataBinding();
        binding.initialize(s);
        DataBindingJSONProvider p = new DataBindingJSONProvider();
        p.setDataBinding(binding);
        ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes());
        Book book = (Book)p.readFrom((Class)Book.class, Book.class,
                                      new Annotation[0], MediaType.APPLICATION_JSON_TYPE,
View Full Code Here

    public String echoWithHeader(String what) {
        List<Header> headers = new ArrayList<Header>();
        Header dummyHeader;
        try {
            dummyHeader = new Header(new QName("uri:org.apache.cxf", "dummy"), "decapitated",
                                            new JAXBDataBinding(String.class));
        } catch (JAXBException e) {
            throw new RuntimeException(e);
        }
        headers.add(dummyHeader);
        context.getMessageContext().put(Header.HEADER_LIST, headers);
View Full Code Here

    @Test
    public void testDeserialization() throws Exception {
        setupClientAndRhino("simple-dlwu-proxy-factory");
        testUtilities.readResourceIntoRhino("/deserializationTests.js");
        DataBinding dataBinding = new JAXBDataBinding(TestBean3.class, TestBean2.class);
        assertNotNull(dataBinding);
        TestBean3 bean = new TestBean3();
        bean.stringItem = "bean1>stringItem";
        bean.doubleItem = -1.0;
        String serialized = serializeObject(dataBinding, bean);
View Full Code Here

    }
   
    @Test
    public void testJAXBWrite() throws Exception {
        Service s = new JAXRSServiceImpl(Collections.singletonList(c), true);
        DataBinding binding = new JAXBDataBinding();
        binding.initialize(s);
        DataBindingProvider p = new DataBindingProvider(binding);
        Book b = new Book("CXF", 127L);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        p.writeTo(b, Book.class, Book.class,
            new Annotation[0], MediaType.TEXT_XML_TYPE, new MetadataMap<String, Object>(), bos);
View Full Code Here

TOP

Related Classes of org.apache.cxf.jaxb.JAXBDataBinding$CachedClassOrNull

Copyright © 2018 www.massapicom. 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.