Package org.apache.cxf.message

Examples of org.apache.cxf.message.Attachment


            if (attachments == null) {
                attachments = new ArrayList<Attachment>();
                exchange.getOutMessage().setAttachments(attachments);
            }
            for (Map.Entry<String, DataHandler> entry : dataHandlers.entrySet()) {
                Attachment att = new AttachmentImpl(entry.getKey(), entry.getValue());
                attachments.add(att);
            }
        }
    }
View Full Code Here


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

        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

       
        Set<Attachment> attachments
            = CastUtils.cast((Set<?>)requestContext.get(CxfConstants.CAMEL_CXF_ATTACHMENTS));
        assertNotNull(attachments);
        assertNotNull(attachments.size() == 1);
        Attachment att = attachments.iterator().next();
        assertEquals("att-1", att.getId());
    }
View Full Code Here

        verifyHeader(headers, "MYFRUITHEADER", "peach");
       
        Collection<Attachment> attachments = cxfMessage.getAttachments();
        assertNotNull(attachments);
        assertNotNull(attachments.size() == 1);
        Attachment att = attachments.iterator().next();
        assertEquals("att-1", att.getId());
    }
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();
       
        assertTrue(((DelegatingInputStream) attIs).getInputStream() instanceof MimeBodyPartInputStream);
        assertTrue(((DelegatingInputStream) attBody).getInputStream() instanceof ByteArrayInputStream);
       
        // check the cached output stream
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();
       
        assertTrue(((DelegatingInputStream) attIs).getInputStream() instanceof MimeBodyPartInputStream);
        assertTrue(((DelegatingInputStream) attBody).getInputStream() instanceof ByteArrayInputStream);
       
        // check the cached output stream
View Full Code Here

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

        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);

        String contentType = getContentType(object, context);
        if (contentType != null) {
View Full Code Here

        if (attachments == null) {
            return null;
        }

        for (Iterator<Attachment> iter = attachments.iterator(); iter.hasNext();) {
            Attachment a = iter.next();
            if (a.getId().equals(id)) {
                return a;
            }
        }

        // Try loading the URL remotely
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.