Package org.apache.cxf.message

Examples of org.apache.cxf.message.Attachment


        }

        public DataHandler get(Object key) {
            Iterator<Attachment> it = collection.iterator();
            while (it.hasNext()) {
                Attachment at = it.next();
                if (key.equals(at.getId())) {
                    return at.getDataHandler();
                }
            }
            return null;
        }
View Full Code Here


        }
       
        public DataHandler remove(Object key) {
            Iterator<Attachment> it = collection.iterator();
            while (it.hasNext()) {
                Attachment at = it.next();
                if (key.equals(at.getId())) {
                    collection.remove(at);
                    return at.getDataHandler();
                }
            }
            return null;
        }
View Full Code Here

                }
            }
            return null;
        }
        public DataHandler put(String key, DataHandler value) {
            Attachment at = new AttachmentImpl(key, value);
            collection.add(at);
            return value;
        }
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

                if (attachments == null) {
                    attachments = new ArrayList<Attachment>();
                    out.setAttachments(attachments);
                }
                for (Map.Entry<String, DataHandler> entry : dataHandlers.entrySet()) {
                    Attachment att = new AttachmentImpl(entry.getKey(), entry.getValue());
                    attachments.add(att);
                }
            }
            out.remove(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
        }
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

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.