Package org.codehaus.xfire.attachments

Examples of org.codehaus.xfire.attachments.Attachment


        InMessage res = invokeService(msg, HttpTransport.HTTP_BINDING);

        Attachments atts = res.getAttachments();
        Iterator parts = atts.getParts();
        assertTrue(parts.hasNext());
        Attachment att = (Attachment) parts.next();
       
        Document response = (Document) res.getProperty(RESPONSE);
        addNamespace("m", "http://xfire.codehaus.org/mtom");
        addNamespace("xop", "http://www.w3.org/2004/08/xop/include");
        assertValid("//s:Body/m:GetPictureResponse/m:image/xop:Include", response);
View Full Code Here


                    exchange.setMessage(outMsg, "out");
                }
                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

        inMessage.setContent(new DOMSource(element));
        // Retrieve attachments
        Attachments attachments = (Attachments) ctx.getInMessage().getAttachments();
        if (attachments != null) {
            for (Iterator it = attachments.getParts(); it.hasNext();) {
                Attachment part = (Attachment) it.next();
                inMessage.addAttachment(part.getId(), part.getDataHandler());
            }
        }
        exchange.setMessage(inMessage, "in");
    }
View Full Code Here

        inMessage.setContent(new DOMSource(element));
        // Retrieve attachments
        Attachments attachments = (Attachments) ctx.getInMessage().getAttachments();
        if (attachments != null) {
            for (Iterator it = attachments.getParts(); it.hasNext();) {
                Attachment part = (Attachment) it.next();
                inMessage.addAttachment(part.getId(), part.getDataHandler());
            }
        }
        exchange.setMessage(inMessage, "in");
    }
View Full Code Here

                    exchange.setMessage(outMsg, "out");
                }
                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

    }

    @Override
    public byte[] getAttachmentAsByteArray(String cid)
    {
        Attachment a = AttachmentUtil.getAttachment(cid, context.getOutMessage());
        if (a == null)
            throw new IllegalArgumentException("Attachment " + cid + " was not found.");

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        try
        {
            copy(a.getDataHandler().getInputStream(), bos);
        }
        catch (IOException e)
        {
            throw new XFireRuntimeException("Could not read attachment.", e);
        }
View Full Code Here


    @Override
    public DataHandler getAttachmentAsDataHandler(String cid)
    {
        Attachment a = AttachmentUtil.getAttachment(cid, context.getInMessage());
        if (a == null)
            throw new IllegalArgumentException("Attachment " + cid + " was not found.");

        return a.getDataHandler();
    }
View Full Code Here

    public Object readInclude(String type, MessageReader reader, MessageContext context)
        throws XFireFault
    {
        String href = reader.getAttributeReader(XOP_HREF).getValue();
       
        Attachment att = AttachmentUtil.getAttachment(href, context.getInMessage());
       
        if (att == null)
        {
            throw new XFireFault("Could not find the attachment " + href, XFireFault.SENDER);
        }
View Full Code Here

            context.getOutMessage().setAttachments(attachments);
        }

        String id = AttachmentUtil.createContentID(getSchemaType().getNamespaceURI());
       
        Attachment att = createAttachment(object, id);
       
        attachments.addPart(att);
         
        String contentType = getContentType(object, context);
        if (contentType != null)
View Full Code Here

TOP

Related Classes of org.codehaus.xfire.attachments.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.