Package org.apache.servicemix.jbi.jaxp

Examples of org.apache.servicemix.jbi.jaxp.BytesSource


        }
        if (RESULT_BYTES.equalsIgnoreCase(getResult())) {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            Result result = new StreamResult(buffer);
            transformer.transform(src, result);
            out.setContent(new BytesSource(buffer.toByteArray()));
        } else if (RESULT_STRING.equalsIgnoreCase(getResult())) {
            StringWriter buffer = new StringWriter();
            Result result = new StreamResult(buffer);
            transformer.transform(src, result);
            out.setContent(new StringSource(buffer.toString()));
View Full Code Here


            if (value.supportsGetValueAs(Document.class)) {
                Document doc = (Document) value.getValueAs(Document.class);
                inputSource = new DOMSource(doc);
            } else if (value.supportsGetValueAs(byte[].class)) {
                byte[] data = (byte[]) value.getValueAs(byte[].class);
                inputSource = new BytesSource(data);
            } else if (value.supportsGetValueAs(String.class)) {
                String data = (String) value.getValueAs(String.class);
                inputSource = new StringSource(data);
            } else {
                throw new UnsupportedOperationException("Unable to retrieve value");
            }
        } else if (payload instanceof Document) {
            inputSource = new DOMSource((Document) payload);
        } else if (payload instanceof byte[]) {
            inputSource = new BytesSource((byte[]) payload);
        } else if (payload instanceof String) {
            inputSource = new StringSource((String) payload);
        } else {
            throw new UnsupportedOperationException("Unable to retrieve value");
        }
View Full Code Here

        Properties props = outputProperties != null ? outputProperties : EMPTY_PROPS;
        if (RESULT_BYTES.equalsIgnoreCase(getResult())) {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            Result result = new StreamResult(buffer);
            expression.pull(dynamicEnv, result, props);
            out.setContent(new BytesSource(buffer.toByteArray()));
        } else if (RESULT_STRING.equalsIgnoreCase(getResult())) {
            StringWriter buffer = new StringWriter();
            Result result = new StreamResult(buffer);
            expression.pull(dynamicEnv, result, props);
            out.setContent(new StringSource(buffer.toString()));
View Full Code Here

        checkUserIdNamespace(node2);
       
        msg.setSource(new DOMSource(node2));
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        marshaler.createWriter(msg).write(baos);
        Node node = sourceTransformer.toDOMNode(new BytesSource(baos.toByteArray()));
        checkUserIdNamespace(node);
  }
View Full Code Here

        SoapMarshaler marshaler = new SoapMarshaler(true);
        marshaler.setSoapUri(SoapMarshaler.SOAP_11_URI);
        SoapMessage msg = new SoapMessage();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        marshaler.createWriter(msg).write(baos);
        Node node = sourceTransformer.toDOMNode(new BytesSource(baos.toByteArray()));
        assertNotNull(node);
        Element root = ((Document) node).getDocumentElement();
        assertEquals(SoapMarshaler.SOAP_11_URI, root.getNamespaceURI());
    }
View Full Code Here

        }
        else {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            Result result = new StreamResult(buffer);
            transformer.transform(src, result);
            out.setContent(new BytesSource(buffer.toByteArray()));
        }
    }
View Full Code Here

        checkUserIdNamespace(node2);
       
        msg.setSource(new DOMSource(node2));
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        marshaler.createWriter(msg).write(baos);
        Node node = sourceTransformer.toDOMNode(new BytesSource(baos.toByteArray()));
        checkUserIdNamespace(node);
  }
View Full Code Here

        SoapMarshaler marshaler = new SoapMarshaler(true);
        marshaler.setSoapUri(SoapMarshaler.SOAP_11_URI);
        SoapMessage msg = new SoapMessage();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        marshaler.createWriter(msg).write(baos);
        Node node = sourceTransformer.toDOMNode(new BytesSource(baos.toByteArray()));
        assertNotNull(node);
        Element root = ((Document) node).getDocumentElement();
        assertEquals(SoapMarshaler.SOAP_11_URI, root.getNamespaceURI());
    }
View Full Code Here

        Source src = new StringSource("<hello>world</hello>");
        testSerializeDeserialize(src);
    }

    public void testSerializeDeserializeWithBytesSource() throws Exception {
        Source src = new BytesSource("<hello>world</hello>".getBytes());
        testSerializeDeserialize(src);
    }
View Full Code Here

        }
        else {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            Result result = new StreamResult(buffer);
            transformer.transform(src, result);
            out.setContent(new BytesSource(buffer.toByteArray()));
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.servicemix.jbi.jaxp.BytesSource

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.