Package org.apache.axis

Examples of org.apache.axis.Part


       
        dimemultipart = null;

        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


        multipart = null;
        dimemultipart = null;

        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) {
View Full Code Here

                    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

        removeAllAttachments();

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

        //This search will pickit up if its fully qualified location or if it's a content-id
        // that is not prefixed by the cid.

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


        if (!reference.startsWith(Attachments.CIDprefix) && (null != contentLocation)) {
            //Not a content-id check to see if its a relative location id.
View Full Code Here

    public java.util.Iterator getAttachments(
            javax.xml.soap.MimeHeaders headers) {
        java.util.Vector vecParts = new java.util.Vector();
        java.util.Iterator iterator = attachments.values().iterator();
        while(iterator.hasNext()){
            Part part = (Part) iterator.next();
            if(part instanceof AttachmentPart){
                if(((AttachmentPart)part).matches(headers)){
                    vecParts.add(part);
                }
            }
View Full Code Here

            // Instead of throwing NullPointerException like
            // we used to do, throw something meaningful.
            throw new IOException(JavaUtils.getMessage("noAttachments"));
        }

        Part attachmentPart= attachments.createAttachmentPart(dh);

        AttributesImpl attrs = new AttributesImpl();
        if (attributes != null && 0 < attributes.getLength())
            attrs.setAttributes(attributes); //copy the existing ones.

        int typeIndex=-1;
        if((typeIndex = attrs.getIndex(Constants.URI_DEFAULT_SCHEMA_XSI,
                                "type")) != -1){

            //Found a xsi:type which should not be there for attachments.
            attrs.removeAttribute(typeIndex);
        }

        attrs.addAttribute("", Constants.ATTR_HREF, "href",
                               "CDATA", attachmentPart.getContentIdRef() );

        context.startElement(name, attrs);
        context.endElement(); //There is no data to so end the element.
    }
View Full Code Here

      if (useAttachments) {
        // System.out.println("Creating attachment"); //DEBUG
        SOAPConstants soapConstants = context.getMessageContext().getSOAPConstants();
        DataHandler dataHandler = new DataHandler(new OctetStreamDataSource("test",
                new OctetStream(bytes)));
        Part attachmentPart = attachments.createAttachmentPart(dataHandler);

        AttributesImpl attrs = new AttributesImpl();
        if (attributes != null && 0 < attributes.getLength())
          attrs.setAttributes(attributes); // copy the existing ones.

        int typeIndex = -1;
        if ((typeIndex = attrs.getIndex(Constants.URI_DEFAULT_SCHEMA_XSI, "type")) != -1) {
          // Found a xsi:type which should not be there for attachments.
          attrs.removeAttribute(typeIndex);
        }

        attrs.addAttribute("", soapConstants.getAttrHref(), soapConstants.getAttrHref(), "CDATA",
                attachmentPart.getContentIdRef());
        context.startElement(name, attrs);
        context.endElement();
      } else {
        // no attachment support - Base64 encode
        // System.out.println("No attachment support"); //DEBUG
View Full Code Here

      if (useAttachments) {
        // System.out.println("Creating attachment"); //DEBUG
        SOAPConstants soapConstants = context.getMessageContext().getSOAPConstants();
        DataHandler dataHandler = new DataHandler(new OctetStreamDataSource("test",
                new OctetStream(bytes)));
        Part attachmentPart = attachments.createAttachmentPart(dataHandler);

        AttributesImpl attrs = new AttributesImpl();
        if (attributes != null && 0 < attributes.getLength())
          attrs.setAttributes(attributes); // copy the existing ones.

        int typeIndex = -1;
        if ((typeIndex = attrs.getIndex(Constants.URI_DEFAULT_SCHEMA_XSI, "type")) != -1) {
          // Found a xsi:type which should not be there for attachments.
          attrs.removeAttribute(typeIndex);
        }

        attrs.addAttribute("", soapConstants.getAttrHref(), soapConstants.getAttrHref(), "CDATA",
                attachmentPart.getContentIdRef());
        context.startElement(name, attrs);
        context.endElement();
      } else {
        // no attachment support - Base64 encode
        // System.out.println("No attachment support"); //DEBUG
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

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.