Package org.apache.axis.attachments

Examples of org.apache.axis.attachments.AttachmentPart


          /*=================================================================
          * Get the object's content, and ingest the document
          *================================================================*/
          try
          {
            AttachmentPart ap = meridio_.getLatestVersionFile((int)docId);
            if (null == ap)
            {
              if (Logging.connectors.isDebugEnabled())
                Logging.connectors.debug("Meridio: Failed to get content for document '" + new Long(docId).toString() + "'");
              // No document.  Delete what's there
              activities.deleteDocument(documentIdentifier);
              i++;
              continue;
            }
            try
            {
              // Get the file name.
              String fileName = ap.getDataHandler().getName();
              // Log what we are about to do.
              if (Logging.connectors.isDebugEnabled())
                Logging.connectors.debug("Meridio: File data is supposedly in "+fileName);
              File theTempFile = new File(fileName);
              if (theTempFile.isFile())
              {
                long fileSize = theTempFile.length();                   // ap.getSize();
                InputStream is = new FileInputStream(theTempFile);      // ap.getDataHandler().getInputStream();
                try
                {
                  repositoryDocument.setBinary(is, fileSize);

                  if (null != activities)
                  {
                    activities.ingestDocument(documentIdentifier, docVersion,
                      fileURL, repositoryDocument);
                  }
                }
                finally
                {
                  is.close();
                }
              }
              else
              {
                if (Logging.connectors.isDebugEnabled())
                  Logging.connectors.debug("Meridio: Expected temporary file was not present - skipping document '"+new Long(docId).toString() + "'");
              }
            }
            finally
            {
              ap.dispose();
            }

          }
          catch (java.net.SocketTimeoutException ioex)
          {
View Full Code Here


        call.setTargetEndpointAddress( new URL(opts.getURL()) ); //Set the target service host and service location,

        java.util.Stack rev= new java.util.Stack();
        //Create an attachment referenced by a generated contentId.
        AttachmentPart ap= new AttachmentPart(new javax.activation.DataHandler(
          "Now is the time", "text/plain" ));
         refs.add(ap.getContentIdRef()); //reference the attachment by contentId.
         ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);

        //Create an attachment referenced by a set contentId.
        String setContentId="rick_did_this";
        ap= new AttachmentPart(new DataHandler(" for all good", "text/plain" ));
          //new MemoryOnlyDataSource(
         ap.setContentId(setContentId)
         refs.add("cid:" + setContentId); //reference the attachment by contentId.
         ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);

        //Create an attachment referenced by a absolute contentLocation.
        ap= new AttachmentPart(new DataHandler( " men to", "text/plain" ));
          //new MemoryOnlyDataSource( " men to", "text/plain" )));
        ap.setContentLocation(baseLoc+ "/firstLoc")
         refs.add(baseLoc+ "/firstLoc"); //reference the attachment by contentId.
         ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);

        //Create an attachment referenced by relative location to a absolute location.
        ap= new AttachmentPart(new DataHandler( " come to", "text/plain" ));
          // new MemoryOnlyDataSource( " come to", "text/plain" )));
        ap.setContentLocation(baseLoc+ "/secondLoc")
        refs.add("secondLoc"); //reference the attachment by contentId.
        ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);

        //Create an attachment referenced by relative location to a relative location.
        ap= new AttachmentPart(new DataHandler( " the aid of their country.", "text/plain" ));
          // new MemoryOnlyDataSource( " the aid of their country.", "text/plain" )));
        ap.setContentLocation("thirdLoc")
        refs.add("thirdLoc"); //reference the attachment by contentId.
        ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);


        //Now build the message....
View Full Code Here

        /* Setup the MD5 digest */
        MessageDigest messageDigest = MessageDigest.getInstance("MD5");
       
        /* Get the attachment, and pipe it's data to the buffer */
        OutputStream os = createBufferOutputStream();
        AttachmentPart part = (AttachmentPart) attachments[0];
        InputStream attachmentStream = part.getDataHandler().getInputStream();
        long byteCount = 0;
        int b = 0;
        while ((b = attachmentStream.read()) != -1)
        {
          byteCount++;
View Full Code Here

TOP

Related Classes of org.apache.axis.attachments.AttachmentPart

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.