Examples of SAAJDataSource


Examples of org.apache.axis2.saaj.util.SAAJDataSource

            InputStream inputStream = new FileInputStream(new File(System
                    .getProperty("basedir", ".") + "/test-resources" + File.separator +
                    "attach.xml"));
            ap = msg.createAttachmentPart(inputStream, "text/xml");
            DataHandler dh =
                    new DataHandler(new SAAJDataSource(inputStream, 1000, "text/xml", true));

            StringBuffer sb1 = copyToBuffer(dh.getInputStream());
            assertNotNull(ap);

            //Verify attachment part is not empty and contents are correct
View Full Code Here

Examples of org.apache.axis2.saaj.util.SAAJDataSource

     *                                  object, or if there was no <CODE> DataContentHandler</CODE>
     *                                  object for this content object
     * @see #getContent()
     */
    public void setContent(Object object, String contentType) {
        SAAJDataSource source;
        setMimeHeader(HTTPConstants.HEADER_CONTENT_TYPE, contentType);
        Object contentObject;
        if (object instanceof String) {
            try {
                String s = (String)object;
                java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream(s.getBytes());
                source = new SAAJDataSource(bais,
                                            SAAJDataSource.MAX_MEMORY_DISK_CACHED,
                                            contentType, true);
                extractFilename(source);
                this.dataHandler = new DataHandler(source);
                contentObject = object;
            } catch (java.io.IOException io) {
                throw new java.lang.IllegalArgumentException("Illegal Argument");
            }
        } else if (object instanceof java.io.InputStream) {
            try {

                source = new SAAJDataSource((java.io.InputStream)object,
                                            SAAJDataSource.MIN_MEMORY_DISK_CACHED,
                                            contentType, true);
                extractFilename(source);
                this.dataHandler = new DataHandler(source);
                contentObject = null; // the stream has been consumed
            } catch (java.io.IOException io) {
                throw new java.lang.IllegalArgumentException("Illegal Argument");
            }
        } else if (object instanceof StreamSource) {
            try {
                source = new SAAJDataSource(((StreamSource)object).getInputStream(),
                                            SAAJDataSource.MAX_MEMORY_DISK_CACHED,
                                            contentType, true);
                extractFilename(source);
                this.dataHandler = new DataHandler(source);
                contentObject = null; // the stream has been consumed
            } catch (java.io.IOException io) {
                throw new java.lang.IllegalArgumentException("Illegal Argument");
            }
        } else if (object instanceof BufferedImage) {
            try {
                this.dataHandler = new DataHandler(object, contentType);
                contentObject = null; // the stream has been consumed
            } catch (Exception e) {
                throw new java.lang.IllegalArgumentException(e.getMessage());
            }
        } else if (object instanceof byte[]) {
            try {
                contentObject = null;
                java.io.ByteArrayInputStream bais =
                        new java.io.ByteArrayInputStream((byte[])object);
                source = new SAAJDataSource(bais,
                                            SAAJDataSource.MAX_MEMORY_DISK_CACHED,
                                            contentType, true);
                extractFilename(source);

                this.dataHandler = new DataHandler(source);
View Full Code Here

Examples of org.apache.axis2.saaj.util.SAAJDataSource

            AttachmentPart ap;

            InputStream inputStream = TestUtils.getTestFile("attach.xml");
            ap = msg.createAttachmentPart(new StreamSource(inputStream), "text/xml");
            DataHandler dh =
                    new DataHandler(new SAAJDataSource(inputStream, 1000, "text/xml", true));

            StringBuffer sb1 = copyToBuffer(dh.getInputStream());
            assertNotNull(ap);

            //Verify attachment part is not empty and contents are correct
View Full Code Here

Examples of org.apache.axis2.saaj.util.SAAJDataSource

     *                                  object, or if there was no <CODE> DataContentHandler</CODE>
     *                                  object for this content object
     * @see #getContent()
     */
    public void setContent(Object object, String contentType) {
        SAAJDataSource source;
        setMimeHeader(HTTPConstants.HEADER_CONTENT_TYPE, contentType);
        Object contentObject;
        if (object instanceof String) {
            try {
                String s = (String)object;
                java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream(s.getBytes());
                source = new SAAJDataSource(bais,
                                            SAAJDataSource.MAX_MEMORY_DISK_CACHED,
                                            contentType, true);
                extractFilename(source);
                this.dataHandler = new DataHandler(source);
                contentObject = object;
            } catch (java.io.IOException io) {
                throw new java.lang.IllegalArgumentException("Illegal Argument");
            }
        } else if (object instanceof java.io.InputStream) {
            try {

                source = new SAAJDataSource((java.io.InputStream)object,
                                            SAAJDataSource.MIN_MEMORY_DISK_CACHED,
                                            contentType, true);
                extractFilename(source);
                this.dataHandler = new DataHandler(source);
                contentObject = null; // the stream has been consumed
            } catch (java.io.IOException io) {
                throw new java.lang.IllegalArgumentException("Illegal Argument");
            }
        } else if (object instanceof StreamSource) {
            try {
                source = new SAAJDataSource(((StreamSource)object).getInputStream(),
                                            SAAJDataSource.MAX_MEMORY_DISK_CACHED,
                                            contentType, true);
                extractFilename(source);
                this.dataHandler = new DataHandler(source);
                contentObject = null; // the stream has been consumed
            } catch (java.io.IOException io) {
                throw new java.lang.IllegalArgumentException("Illegal Argument");
            }
        } else if (object instanceof BufferedImage) {
            try {
                this.dataHandler = new DataHandler(object, contentType);
                contentObject = null; // the stream has been consumed
            } catch (Exception e) {
                throw new java.lang.IllegalArgumentException(e.getMessage());
            }
        } else if (object instanceof byte[]) {
            try {
                contentObject = null;
                java.io.ByteArrayInputStream bais =
                        new java.io.ByteArrayInputStream((byte[])object);
                source = new SAAJDataSource(bais,
                                            SAAJDataSource.MAX_MEMORY_DISK_CACHED,
                                            contentType, true);
                extractFilename(source);

                this.dataHandler = new DataHandler(source);
View Full Code Here

Examples of org.apache.axis2.saaj.util.SAAJDataSource

            InputStream inputStream = new FileInputStream(new File(System
                    .getProperty("basedir", ".") + "/test-resources" + File.separator +
                    "attach.xml"));
            ap = msg.createAttachmentPart(inputStream, "text/xml");
            DataHandler dh =
                    new DataHandler(new SAAJDataSource(inputStream, 1000, "text/xml", true));

            StringBuffer sb1 = copyToBuffer(dh.getInputStream());
            assertNotNull(ap);

            //Verify attachment part is not empty and contents are correct
View Full Code Here

Examples of org.apache.axis2.saaj.util.SAAJDataSource

     *                                  object, or if there was no <CODE> DataContentHandler</CODE>
     *                                  object for this content object
     * @see #getContent()
     */
    public void setContent(Object object, String contentType) {
        SAAJDataSource source;
        setMimeHeader(HTTPConstants.HEADER_CONTENT_TYPE, contentType);
        if (object instanceof String) {
            try {
                String s = (String)object;
                java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream(s.getBytes());
                source = new SAAJDataSource(bais,
                                            SAAJDataSource.MAX_MEMORY_DISK_CACHED,
                                            contentType, true);
                extractFilename(source);
                this.dataHandler = new DataHandler(source);
            } catch (java.io.IOException io) {
                throw new java.lang.IllegalArgumentException("Illegal Argument");
            }
        } else if (object instanceof java.io.InputStream) {
            try {

                source = new SAAJDataSource((java.io.InputStream)object,
                                            SAAJDataSource.MIN_MEMORY_DISK_CACHED,
                                            contentType, true);
                extractFilename(source);
                this.dataHandler = new DataHandler(source);
            } catch (java.io.IOException io) {
                throw new java.lang.IllegalArgumentException("Illegal Argument");
            }
        } else if (object instanceof StreamSource) {
            try {
                source = new SAAJDataSource(((StreamSource)object).getInputStream(),
                                            SAAJDataSource.MAX_MEMORY_DISK_CACHED,
                                            contentType, true);
                extractFilename(source);
                this.dataHandler = new DataHandler(source);
            } catch (java.io.IOException io) {
                throw new java.lang.IllegalArgumentException("Illegal Argument");
            }
        } else if (object instanceof BufferedImage) {
            try {
                this.dataHandler = new DataHandler(object, contentType);
            } catch (Exception e) {
                throw new java.lang.IllegalArgumentException(e.getMessage());
            }
        } else if (object instanceof byte[]) {
            try {
                java.io.ByteArrayInputStream bais =
                        new java.io.ByteArrayInputStream((byte[])object);
                source = new SAAJDataSource(bais,
                                            SAAJDataSource.MAX_MEMORY_DISK_CACHED,
                                            contentType, true);
                extractFilename(source);

                this.dataHandler = new DataHandler(source);
View Full Code Here

Examples of org.apache.axis2.saaj.util.SAAJDataSource

            AttachmentPart ap;

            InputStream inputStream = TestUtils.getTestFile("attach.xml");
            ap = msg.createAttachmentPart(inputStream, "text/xml");
            DataHandler dh =
                    new DataHandler(new SAAJDataSource(inputStream, 1000, "text/xml", true));

            StringBuffer sb1 = copyToBuffer(dh.getInputStream());
            assertNotNull(ap);

            //Verify attachment part is not empty and contents are correct
View Full Code Here

Examples of org.apache.axis2.saaj.util.SAAJDataSource

     *                                  DataContentHandler</CODE> object for this content
     *                                  object
     * @see #getContent()
     */
    public void setContent(Object object, String contentType) {
        SAAJDataSource source;
        setMimeHeader(HTTPConstants.HEADER_CONTENT_TYPE, contentType);
        Object contentObject;
        if (object instanceof String) {
            try {
                String s = (String) object;
                java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream(s.getBytes());
                source = new SAAJDataSource(bais,
                        SAAJDataSource.MAX_MEMORY_DISK_CACHED,
                        contentType, true);
                extractFilename(source);
                dataHandler = new DataHandler(source);
                contentObject = object;
            } catch (java.io.IOException io) {
                throw new java.lang.IllegalArgumentException("Illegal Argument");
            }
        } else if (object instanceof java.io.InputStream) {
            try {
                source = new SAAJDataSource((java.io.InputStream) object,
                        SAAJDataSource.MAX_MEMORY_DISK_CACHED,
                        contentType, true);
                extractFilename(source);
                dataHandler = new DataHandler(source);
                contentObject = null; // the stream has been consumed
            } catch (java.io.IOException io) {
                throw new java.lang.IllegalArgumentException("Illegal Argument");
            }
        } else if (object instanceof StreamSource) {
            try {
                source = new SAAJDataSource(((StreamSource) object).getInputStream(),
                        SAAJDataSource.MAX_MEMORY_DISK_CACHED,
                        contentType, true);
                extractFilename(source);
                dataHandler = new DataHandler(source);
                contentObject = null; // the stream has been consumed
View Full Code Here

Examples of org.apache.axis2.saaj.util.SAAJDataSource

     *                                  object, or if there was no <CODE> DataContentHandler</CODE>
     *                                  object for this content object
     * @see #getContent()
     */
    public void setContent(Object object, String contentType) {
        SAAJDataSource source;
        setMimeHeader(HTTPConstants.HEADER_CONTENT_TYPE, contentType);
        if (object instanceof String) {
            try {
                String s = (String)object;
                java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream(s.getBytes());
                source = new SAAJDataSource(bais,
                                            SAAJDataSource.MAX_MEMORY_DISK_CACHED,
                                            contentType, true);
                extractFilename(source);
                this.dataHandler = new DataHandler(source);
            } catch (java.io.IOException io) {
                throw new java.lang.IllegalArgumentException("Illegal Argument");
            }
        } else if (object instanceof java.io.InputStream) {
            try {

                source = new SAAJDataSource((java.io.InputStream)object,
                                            SAAJDataSource.MIN_MEMORY_DISK_CACHED,
                                            contentType, true);
                extractFilename(source);
                this.dataHandler = new DataHandler(source);
            } catch (java.io.IOException io) {
                throw new java.lang.IllegalArgumentException("Illegal Argument");
            }
        } else if (object instanceof StreamSource) {
            try {
                source = new SAAJDataSource(((StreamSource)object).getInputStream(),
                                            SAAJDataSource.MAX_MEMORY_DISK_CACHED,
                                            contentType, true);
                extractFilename(source);
                this.dataHandler = new DataHandler(source);
            } catch (java.io.IOException io) {
                throw new java.lang.IllegalArgumentException("Illegal Argument");
            }
        } else if (object instanceof BufferedImage) {
            try {
                this.dataHandler = new DataHandler(object, contentType);
            } catch (Exception e) {
                throw new java.lang.IllegalArgumentException(e.getMessage());
            }
        } else if (object instanceof byte[]) {
            try {
                java.io.ByteArrayInputStream bais =
                        new java.io.ByteArrayInputStream((byte[])object);
                source = new SAAJDataSource(bais,
                                            SAAJDataSource.MAX_MEMORY_DISK_CACHED,
                                            contentType, true);
                extractFilename(source);

                this.dataHandler = new DataHandler(source);
View Full Code Here

Examples of org.apache.axis2.saaj.util.SAAJDataSource

            AttachmentPart ap;

            InputStream inputStream = TestUtils.getTestFile("attach.xml");
            ap = msg.createAttachmentPart(new StreamSource(inputStream), "text/xml");
            DataHandler dh =
                    new DataHandler(new SAAJDataSource(inputStream, 1000, "text/xml", true));

            StringBuffer sb1 = copyToBuffer(dh.getInputStream());
            assertNotNull(ap);

            //Verify attachment part is not empty and contents are correct
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.