Package org.apache.cxf.message

Examples of org.apache.cxf.message.Attachment


        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


                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

        super(Phase.SEND);
    }

    public void handleMessage(Message message) throws Fault {
        Assert.assertEquals("check attachment count", 1, message.getAttachments().size());
        Attachment att = message.getAttachments().iterator().next();
        Assert.assertNotNull("Attachment is null", att);
        Assert.assertNotNull("Attachment content-type is null", att.getDataHandler().getDataSource()
                .getContentType());
    }
View Full Code Here

        Collection<Attachment> attachments = resMsg.getAttachments();
        assertNotNull(attachments);
        assertEquals(1, attachments.size());

        Attachment inAtt = attachments.iterator().next();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        IOUtils.copy(inAtt.getDataHandler().getInputStream(), out);
        out.close();
        assertEquals(37448, out.size());
    }
View Full Code Here

        Collection<Attachment> attachments = resMsg.getAttachments();
        assertNotNull(attachments);
        assertEquals(1, attachments.size());

        Attachment inAtt = attachments.iterator().next();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        IOUtils.copy(inAtt.getDataHandler().getInputStream(), out);
        out.close();
        assertEquals(37448, out.size());
    }
View Full Code Here

        Collection<Attachment> attachments = resMsg.getAttachments();
        assertNotNull(attachments);
        assertEquals(1, attachments.size());

        Attachment inAtt = attachments.iterator().next();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        IOUtils.copy(inAtt.getDataHandler().getInputStream(), out);
        out.close();
        assertTrue("Wrong size: " + out.size()
                   + "\n" + out.toString(),
                   out.size() > 970 && out.size() < 1020);
        unregisterServStatic("http://localhost:" + PORT + "/policy.xsd");
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.