Package org.apache.axiom.attachments

Examples of org.apache.axiom.attachments.ByteArrayDataSource


           
            // Write out the mime boundary
            startWritingMime(outStream, boundary);

            javax.activation.DataHandler dh =
                new javax.activation.DataHandler(new ByteArrayDataSource(xmlData,
                                                 "text/xml; charset=" + charSetEncoding));
            MimeBodyPart rootMimeBodyPart = new MimeBodyPart();
            rootMimeBodyPart.setDataHandler(dh);

            rootMimeBodyPart.addHeader("Content-Type",
View Full Code Here


        Base64Binary base64Binary = new Base64Binary();
        testBase64Binary.setTestBase64Binary(base64Binary);

        String testString = "new test string";

        DataHandler dataHandler = new DataHandler(new ByteArrayDataSource(testString.getBytes()));
        base64Binary.setBase64Binary(dataHandler);
        ContentType_type0 contentType_type0 = new ContentType_type0();
        contentType_type0.setContentType_type0("test content type");
        base64Binary.setContentType(contentType_type0);
View Full Code Here

    public void testBase64MultiElement(){

        TestBase64MultiElement testBase64MultiElement = new TestBase64MultiElement();
        String testString = "testing base 64 elements";
        DataHandler dataHandler = new DataHandler(new ByteArrayDataSource(testString.getBytes()));
        testBase64MultiElement.setParam1(dataHandler);
        testBase64MultiElement.setParam2("test string");
        testBase64MultiElement.setParam3(5);

        try {
View Full Code Here

                Base64.encode(textTobeSent.getBytes()) +
                "</ns2:QualifiedElement></ns1:testElementText>";
        try {
            ArrayList properties = new ArrayList();
            properties.add(new QName("http://testQElementText.org", "QualifiedElement", "ns2"));
            properties.add(new DataHandler(new ByteArrayDataSource(textTobeSent.getBytes())));

            XMLStreamReader pullParser = new ADBXMLStreamReaderImpl(
                    new QName("http://testElementText.org", "testElementText", "ns1"),
                    properties.toArray(),
                    null);
View Full Code Here

                String contentType =
                        (format.isSOAP11() ? SOAP11Constants.SOAP_11_CONTENT_TYPE :
                                             SOAP12Constants.SOAP_12_CONTENT_TYPE)
                        + "; charset=" + format.getCharSetEncoding();
                DataHandler rootDataHandler =
                        new DataHandler(new ByteArrayDataSource(baos.toByteArray(), contentType));
                MIMEOutputUtils.writeDataHandlerWithAttachmentsMessage(rootDataHandler,
                        contentType, out, attachmentsMap, format);
            }
            saveChanges();
        } catch (Exception e) {
View Full Code Here

    public static javax.activation.DataHandler convertToBase64Binary(String s) {
        // reusing the byteArrayDataSource from the Axiom classes
        if ((s == null) || s.equals("")){
            return null;
        }
        ByteArrayDataSource byteArrayDataSource = new ByteArrayDataSource(
                Base64.decode(s)
        );
        return new DataHandler(byteArrayDataSource);
    }
View Full Code Here

        Base64Binary base64Binary = new Base64Binary();
        testExtension.setTestExtension(base64Binary);

        String testString = "test base 64 eleemnt";
        DataHandler dataHandler = new DataHandler(new ByteArrayDataSource(testString.getBytes()));
        base64Binary.setBase64Binary(dataHandler);

        ContentType_type0 contentType_type0 = new ContentType_type0();
        contentType_type0.setContentType_type0("test string");
        base64Binary.setContentType(contentType_type0);
View Full Code Here

        content.setSrc("foo");
        assertNotNull(content);
        assertEquals("text/foo", content.getMimeType().toString());
        assertEquals("foo", content.getSrc().toString());
        content = factory.newContent(new MimeType("text/foo"));
        content.setDataHandler(new DataHandler(new ByteArrayDataSource("foo".getBytes())));
        assertEquals("Zm9v", content.getValue());
        assertEquals(Content.Type.MEDIA, content.getContentType());
        el = factory.newName();
        assertNotNull(el);
        el = factory.newName();
View Full Code Here

    private void performTestNewDataHandler(StandardTypesServiceClient serviceClient) throws IOException {
        DataHandler[] dha = new DataHandler[3];
        dha[0] = new DataHandler("Some data", "text/plain");
        dha[1] = new DataHandler(this.getClass().getClassLoader().getResource("standard-types-service.composite"));
        dha[2] = new DataHandler(new ByteArrayDataSource("Some data2".getBytes()));

        for (int i = 0; i < dha.length; ++i) {
            DataHandler actual = serviceClient.getNewDataHandlerForward(dha[i]);
            // Note: The DataHandler returned may use a different type of DataSource.
            // Compare the data content instead of using equals().
View Full Code Here

    private void performTestNewDataHandlerArray(StandardTypesServiceClient serviceClient) throws IOException {
        DataHandler[] dha = new DataHandler[3];
        dha[0] = new DataHandler("Some data", "text/plain");
        dha[1] = new DataHandler(this.getClass().getClassLoader().getResource("standard-types-service.composite"));
        dha[2] = new DataHandler(new ByteArrayDataSource("Some data2".getBytes()));

        DataHandler[] actual = serviceClient.getNewDataHandlerArrayForward(dha);
        Assert.assertEquals(dha.length, actual.length);
        for (int i = 0; i < dha.length; ++i) {
            // Note: The DataHandler returned may use a different type of DataSource.
View Full Code Here

TOP

Related Classes of org.apache.axiom.attachments.ByteArrayDataSource

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.