Package javax.jbi.messaging

Examples of javax.jbi.messaging.NormalizedMessage.addAttachment()


        me.setOperation(new QName("uri", "op"));
        me.setProperty("myProp", "myValue");
        NormalizedMessage msg = me.createMessage();
        msg.setProperty("myMsgProp", "myMsgValue");
        msg.setContent(src);
        msg.addAttachment("myAttachment", new DataHandler(new StreamDataSource(new ByteArrayInputStream("hello".getBytes()))));
        me.setMessage(msg, "in");
        assertNotNull(((NormalizedMessageImpl) msg).getBody());

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
View Full Code Here


        DataHandler dh = new DataHandler(new ByteArrayDataSource("test".getBytes(), "test"));

        // first test with existing attachments
        MessageExchangeImpl inOnly = new InOnlyImpl("inonly");
        NormalizedMessage msg = inOnly.createMessage();
        msg.addAttachment("att_1", dh);
        inOnly.setMessage(msg, "in");

        assertNotNull(inOnly.getMessage("in").getAttachment("att_1"));
        assertNull(inOnly.getMessage("in").getAttachment("att_2"));
       
View Full Code Here

        me.setMessage(in, "in");
        if (forwardAttachments) {
            Set names = srcMessage.getAttachmentNames();
            for (Iterator iter = names.iterator(); iter.hasNext();) {
                String name = (String) iter.next();
                in.addAttachment(name, srcMessage.getAttachment(name));
            }
        }
        if (forwardProperties) {
            Set names  = srcMessage.getPropertyNames();
            for (Iterator iter = names.iterator(); iter.hasNext();) {
View Full Code Here

                } else {
                    NormalizedMessage msg = xchng.createMessage();
                    //copy attachments
                    if (outMessage != null && outMessage.getAttachments() != null) {
                        for (Attachment att : outMessage.getAttachments()) {
                            msg.addAttachment(att.getId(), att
                                    .getDataHandler());
                        }
                    }
                    //copy properties
                   
View Full Code Here

                }
                Attachments attachments = ctx.getCurrentMessage().getAttachments();
                if (attachments != null) {
                    for (Iterator it = attachments.getParts(); it.hasNext();) {
                        Attachment att = (Attachment) it.next();
                        outMsg.addAttachment(att.getId(), att.getDataHandler());
                    }
                }
                outMsg.setContent(new StringSource(out.toString(charSet)));
            }
            if (exchange.isTransacted() && Boolean.TRUE.equals(exchange.getProperty(JbiConstants.SEND_SYNC))) {
View Full Code Here

        me.setOperation(new QName("uri", "op"));
        me.setProperty("myProp", "myValue");
        NormalizedMessage msg = me.createMessage();
        msg.setProperty("myMsgProp", "myMsgValue");
        msg.setContent(src);
        msg.addAttachment("myAttachment", new DataHandler(new StreamDataSource(new ByteArrayInputStream("hello".getBytes()))));
        me.setMessage(msg, "in");
        assertNotNull(((NormalizedMessageImpl) msg).getBody());
       
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
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.