Package org.apache.cxf.message

Examples of org.apache.cxf.message.Attachment


        assertNotNull(atts);
       
        Iterator<Attachment> itr = atts.iterator();
        assertTrue(itr.hasNext());
       
        Attachment a = itr.next();
        assertNotNull(a);
       
        InputStream attIs = a.getDataHandler().getInputStream();
       
        assertFalse(itr.hasNext());
       
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        IOUtils.copy(attIs, out);
View Full Code Here


    }

    public String addMtomAttachment(byte[] data, int offset, int length, String mimeType, String elementNS,
                                    String elementLocalName) {
       
        Attachment att = AttachmentUtil.createMtomAttachment(
                             isXop, mimeType, elementNS, data, offset, length, threshold);
        if (att != null) {
            atts.add(att);
            lastElementName = new QName(elementNS, elementLocalName);
            return "cid:" + att.getId();
        } else {
            return null;
        }
    }
View Full Code Here

        }
    }

    public String addMtomAttachment(DataHandler handler, String elementNS, String elementLocalName) {

        Attachment att = AttachmentUtil.createMtomAttachmentFromDH(isXop, handler, elementNS, threshold);
        if (att != null) {
            atts.add(att);
            lastElementName = new QName(elementNS, elementLocalName);
            return "cid:" + att.getId();
        } else {
            return null;
        }
    }
View Full Code Here

        assertNotNull(atts);
       
        Iterator<Attachment> itr = atts.iterator();
        assertTrue(itr.hasNext());
       
        Attachment a = itr.next();
        assertNotNull(a);
       
        InputStream attIs = a.getDataHandler().getInputStream();
       
        // check the cached output stream
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        IOUtils.copy(attBody, out);
        assertTrue(out.toString().startsWith("<env:Envelope"));
View Full Code Here

        assertNotNull(atts);

        Iterator<Attachment> itr = atts.iterator();
        assertTrue(itr.hasNext());

        Attachment a = itr.next();
        assertNotNull(a);

        InputStream attIs = a.getDataHandler().getInputStream();

        // check the cached output stream
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        IOUtils.copy(attBody, out);
        assertTrue(out.toString().startsWith("<env:Envelope"));
View Full Code Here

        assertNotNull(atts);
       
        Iterator<Attachment> itr = atts.iterator();
        assertTrue(itr.hasNext());
       
        Attachment a = itr.next();
        assertNotNull(a);
       
        InputStream attIs = a.getDataHandler().getInputStream();

        // check the cached output stream
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        IOUtils.copy(attBody, out);
        assertTrue(out.toString().startsWith("<?xml"));
View Full Code Here

        assertNotNull(atts);
       
        Iterator<Attachment> itr = atts.iterator();
        assertTrue(itr.hasNext());
       
        Attachment a = itr.next();
        assertNotNull(a);
       
        InputStream attIs = a.getDataHandler().getInputStream();
       
        // check the cached output stream
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        IOUtils.copy(attBody, out);
        assertTrue(out.toString().startsWith("<?xml"));
View Full Code Here

        assertNotNull(atts);
       
        Iterator<Attachment> itr = atts.iterator();
        assertTrue(itr.hasNext());
       
        Attachment a = itr.next();
        assertNotNull(a);
       
        InputStream attIs = a.getDataHandler().getInputStream();
       
        assertFalse(itr.hasNext());
       
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        IOUtils.copy(attIs, out);
View Full Code Here

   
    private Object readInclude(String type, MessageReader reader,
                              Context context) throws DatabindingException {
        String href = reader.getAttributeReader(XOP_HREF).getValue().trim();

        Attachment att = AttachmentUtil.getAttachment(href, context.getAttachments());

        if (att == null) {
            throw new DatabindingException("Could not find the attachment " + href);
        }
View Full Code Here

            context.setAttachments(attachments);
        }

        String id = AttachmentUtil.createContentID(getSchemaType().getNamespaceURI());

        Attachment att = createAttachment(object, id);

        attachments.add(att);
       
        MessageWriter include = writer.getElementWriter(XOP_INCLUDE);
        MessageWriter href = include.getAttributeWriter(XOP_HREF);
View Full Code Here

TOP

Related Classes of org.apache.cxf.message.Attachment

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.