Package com.alibaba.citrus.service.mail.support

Examples of com.alibaba.citrus.service.mail.support.ResourceDataSource


        DataSource ds;

        try {
            ds = new URLDataSource(resource.getURL());
        } catch (IOException e) {
            ds = new ResourceDataSource(resource);
        }

        MimeBodyPart bodyPart = new MimeBodyPart();

        bodyPart.setDataHandler(new DataHandler(ds));
View Full Code Here


            DataSource ds;

            try {
                ds = new URLDataSource(resource.getURL());
            } catch (IOException e) {
                ds = new ResourceDataSource(resource);
            }

            if (fileName == null) {
                fileName = resourceName;
            }
View Full Code Here

        } catch (IllegalArgumentException e) {
            assertThat(e, exception("dataSource"));
        }

        // DS: text, no name
        DataSource dataSource = new ResourceDataSource(factory.getResource("testfile.txt"), null, "text/plain") {
            @Override
            public String getName() {
                return null;
            }
        };

        content = new AttachmentContent(dataSource);
        builder.setContent(content);

        try {
            getMessageAsText();
            fail();
        } catch (MailBuilderException e) {
            assertThat(e, exception("No fileName was specified with "
                                    + "DataSource[Resource[testfile.txt, loaded by ResourceLoadingService]]"));
        }

        // DS: text, no name, name specified
        content = new AttachmentContent(dataSource, "testfile.txt");
        builder.setContent(content);

        assert_TextPlain_testfile_QuotedPrintable();

        // DS: text, default name
        dataSource = new ResourceDataSource(factory.getResource("testfile.txt"), null, "text/plain");

        content = new AttachmentContent(dataSource);
        builder.setContent(content);

        assert_TextPlain_testfile_QuotedPrintable();

        // DS: gif image, name specfied
        dataSource = new ResourceDataSource(factory.getResource("java.gif"), null, "image/gif");

        content = new AttachmentContent(dataSource, "我的图片.gif");
        builder.setContent(content);

        assert_ImageGif_javagif_我的图片_base64();
View Full Code Here

        DataSource ds;

        try {
            ds = new URLDataSource(resource.getURL());
        } catch (IOException e) {
            ds = new ResourceDataSource(resource);
        }

        MimeBodyPart bodyPart = new MimeBodyPart();

        bodyPart.setDataHandler(new DataHandler(ds));
View Full Code Here

            DataSource ds;

            try {
                ds = new URLDataSource(resource.getURL());
            } catch (IOException e) {
                ds = new ResourceDataSource(resource);
            }

            if (fileName == null) {
                fileName = resourceName;
            }
View Full Code Here

            DataSource ds;

            try {
                ds = new URLDataSource(resource.getURL());
            } catch (IOException e) {
                ds = new ResourceDataSource(resource);
            }

            if (fileName == null) {
                fileName = resourceName;
            }
View Full Code Here

        DataSource ds;

        try {
            ds = new URLDataSource(resource.getURL());
        } catch (IOException e) {
            ds = new ResourceDataSource(resource);
        }

        MimeBodyPart bodyPart = new MimeBodyPart();

        bodyPart.setDataHandler(new DataHandler(ds));
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.service.mail.support.ResourceDataSource

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.