Package org.apache.axis

Examples of org.apache.axis.Part


     * @param  The reference that referers to an attachment.
     * @return The part associated with the removed attachment, or null.
     */
     public Part removeAttachmentPart(String reference) throws org.apache.axis.AxisFault{
                mergeinAttachments();
                Part removedPart=getAttachmentByReference(reference);
                if(removedPart!=null){
                        attachments.remove(removedPart.getContentId());
                        attachments.remove(removedPart.getContentLocation());
                        orderedAttachments.remove(removedPart);
                }
                return removedPart;
        }
View Full Code Here


         * @param newPart new part to add
         * @returns Part old attachment with the same Content-ID, or null.
         */
        public Part addAttachmentPart(Part newPart) throws org.apache.axis.AxisFault{
                mergeinAttachments();
                Part oldPart=(Part)attachments.put(newPart.getContentId(),newPart);
                if(oldPart!=null){
                        orderedAttachments.remove(oldPart);
                        attachments.remove(oldPart.getContentLocation());
                }
                orderedAttachments.add(newPart);
                if(newPart.getContentLocation()!=null){
                        attachments.put(newPart.getContentLocation(),newPart);
                }
View Full Code Here

        if (!(datahandler instanceof javax.activation.DataHandler)) {
            throw new org.apache.axis.AxisFault(JavaUtils.getMessage(
                    "unsupportedAttach", datahandler.getClass().getName(),
                    javax.activation.DataHandler.class.getName()));
        }
        Part ret = new AttachmentPart((javax.activation.DataHandler)datahandler);
        addAttachmentPart(ret);
        return ret;
    }
View Full Code Here

                mergeinAttachments();
        attachments.clear();
                orderedAttachments.clear();
        if (parts != null && !parts.isEmpty()) {
            for (java.util.Iterator i = parts.iterator(); i.hasNext();) {
                Part part = (Part) i.next();
                if (null != part) {
                        addAttachmentPart(part);
                }
            }
        }
View Full Code Here

                mergeinAttachments();
        if (null == reference) return null;
        reference = reference.trim();
        if (0 == reference.length()) return null;

                Part ret = (Part) attachments.get(reference);
                if(ret!=null)
                        return ret;

        String referenceLC = reference.toLowerCase();
        if (!referenceLC.startsWith("cid:") && null != contentLocation) {
View Full Code Here

        }
    }

    public Part getAttachmentByReference( final String[] id ) throws org.apache.axis.AxisFault // if CID should still have CID: prefix. 
        //First see if we have read it in yet.
        Part ret = null;
        for(int i= id.length -1; ret== null && i > -1; --i){
             ret=(AttachmentPart) parts.get(id[i]);
        }

        if ( null == ret) {
            ret = readTillFound(id);
        }
        log.debug(JavaUtils.getMessage("return02",
                "getAttachmentByReference(\"" + id + "\"",
                (ret == null ? "null" : ret.toString())));
        return ret;
    }
View Full Code Here

     *         should be prefixed by "cid:"
     */

    protected Part readTillFound( final String[] id) throws org.apache.axis.AxisFault {
        if (boundaryDelimitedStream == null) return null; //The whole stream has been consumed already
        Part ret = null;

        try {
            if ( soapStreamBDS == boundaryDelimitedStream ) { //Still on the SOAP stream.
                if (!eos) { //The SOAP packet has not been fully read yet. Need to store it away.

View Full Code Here

        throws IOException
    {
        DataHandler dh= (DataHandler)value;
        //Add the attachment content to the message.
        Attachments attachments= context.getCurrentMessage().getAttachments();
        Part attachmentPart= attachments.createAttachmentPart(dh);
        String href= attachmentPart.getContentId();

        AttributesImpl attrs = new AttributesImpl();
        if (attributes != null)
            attrs.setAttributes(attributes); //copy the existing ones.
View Full Code Here

            throw new org.apache.axis.AxisFault("Unsupported attachment type \"" +
                                                datahandler.getClass().getName() +
                                                "\" only supporting \"" +
                                                javax.activation.DataHandler.class.getName() + "\".");
        }
        Part ret = new AttachmentPart(msg,
                                      (javax.activation.DataHandler)datahandler);
        attachments.put(ret.getContentId(), ret);
        return ret;
    }
View Full Code Here

    public void setAttachmentParts(java.util.Collection parts)
            throws org.apache.axis.AxisFault {
        attachments.clear();
        if (parts != null && !parts.isEmpty()) {
            for (java.util.Iterator i = parts.iterator(); i.hasNext();) {
                Part part = (Part) i.next();
                if (null != part) {
                    part.setMessage(msg);
                    attachments.put(part.getContentId(), part);
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.axis.Part

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.