Examples of BytesSource


Examples of org.apache.camel.converter.jaxp.BytesSource

    public Object evaluateAsBytesSource(Exchange exchange) throws Exception {
        initialize(exchange);

        byte[] bytes = evaluateAsBytes(exchange);
        return new BytesSource(bytes);
    }
View Full Code Here

Examples of org.apache.camel.converter.jaxp.BytesSource

    public Object evaluateAsBytesSource(Exchange exchange) throws Exception {
        initialize(exchange);

        byte[] bytes = evaluateAsBytes(exchange);
        return new BytesSource(bytes);
    }
View Full Code Here

Examples of org.apache.camel.converter.jaxp.BytesSource

    public void testNoConversionForOtherXmlSourceTypes() throws Exception {
        a.expectedMessageCount(3);

        send(converter.toDOMSource(MESSAGE));
        send(new StringSource(MESSAGE));
        send(new BytesSource(MESSAGE.getBytes()));

        assertMockEndpointsSatisfied();
        for (Exchange exchange : a.getExchanges()) {
            assertFalse(exchange.getIn().getHeader(BODY_TYPE, Class.class).toString() + " shouldn't have been converted to StreamCache",
                        exchange.getIn().getBody() instanceof StreamCache);
View Full Code Here

Examples of org.apache.camel.converter.jaxp.BytesSource

    }

    @Converter
    public Serializable convertToSerializable(StreamCache cache, Exchange exchange) throws IOException {
        byte[] data = convertToByteArray(cache, exchange);
        return new BytesSource(data);
    }
View Full Code Here

Examples of org.apache.camel.converter.jaxp.BytesSource

    public Object evaluateAsBytesSource(Exchange exchange) throws Exception {
        initialize(exchange);

        byte[] bytes = evaluateAsBytes(exchange);
        return new BytesSource(bytes);
    }
View Full Code Here

Examples of org.apache.camel.converter.jaxp.BytesSource

    public void testNoConversionForOtherXmlSourceTypes() throws Exception {
        a.expectedMessageCount(3);

        send(converter.toDOMSource(MESSAGE));
        send(new StringSource(MESSAGE));
        send(new BytesSource(MESSAGE.getBytes()));

        assertMockEndpointsSatisfied();
        for (Exchange exchange : a.getExchanges()) {
            assertFalse(exchange.getIn().getHeader(BODY_TYPE, Class.class).toString() + " shouldn't have been converted to StreamCache",
                        exchange.getIn().getBody() instanceof StreamCache);
View Full Code Here

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

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

            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

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

        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

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

        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
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.