Examples of Multipart


Examples of com.dotcms.repackage.com.sun.jersey.multipart.MultiPart

        final String salt=Long.toString(System.currentTimeMillis());
        final User sysuser=APILocator.getUserAPI().getSystemUser();
       
        ClientResponse response = contRes.path("/publish/1").type(MediaType.MULTIPART_FORM_DATA_TYPE)
                                   .header(authheader, authvalue).put(ClientResponse.class,
                                           new MultiPart()
                                             .bodyPart(new BodyPart(
                                                     new JSONObject()
                                                        .put("hostFolder", "demo.dotcms.com:/resources")
                                                        .put("title", "newfile"+salt+".txt")
                                                        .put("fileName", "newfile"+salt+".txt")
View Full Code Here

Examples of com.elibom.jogger.http.servlet.multipart.Multipart

   * @throws IOException if there is a problem parsing the multipart/form-data.
   */
  private ServletRequest init() throws MultipartException, IOException {
    // retrieve multipart/form-data parameters
    if (Multipart.isMultipartContent(request)) {
      Multipart multipart = new Multipart();
      multipart.parse(request, new PartHandler() {

        @Override
        public void handleFormItem(String name, String value) {
          multipartParams.put( name, value );
        }
View Full Code Here

Examples of com.sun.jersey.multipart.MultiPart

    protected MultiPart readMultiPart(Class<MultiPart> type, Type genericType,
                              Annotation[] annotations, MediaType mediaType,
                              MultivaluedMap<String, String> headers,
                              InputStream stream) throws IOException, MIMEParsingException {
        MultiPart mp = super.readMultiPart(type, genericType, annotations, mediaType, headers, stream);
        closeableService.add(mp);
        return mp;
    }
View Full Code Here

Examples of javax.mail.Multipart

      mailMessage.setSubject("Hello MAIL");
      mailMessage.setSentDate(new Date());
      //Properties props = ssn.getProperties();
          //props.put("mail.smtp.from", "<>");
 
          Multipart multipart = new MimeMultipart("related");
      MimeBodyPart messageBodyPart = new MimeBodyPart();
          messageBodyPart.setText("Welcome to JavaMail.");
          multipart.addBodyPart(messageBodyPart);
          mailMessage.setContent(multipart);
          mailMessage.setFrom(new InternetAddress("javayou@gmail.com","Winter Lau"));
         
          String mail_postfix = mailaddr.substring(mailaddr.indexOf('@')+1);
          //System.out.println("mail postfix is " + mail_postfix);
View Full Code Here

Examples of javax.mail.Multipart

                              new InternetAddress( userInfo.getEmailForEntity( owner ) ) );
        message.setSubject( "Task Assignment " + type + " Event: " + name );
        message.setSentDate( new Date() );

        // Create a Multipart
        Multipart multipart = new MimeMultipart( "alternative" );

        // Add text message
        BodyPart messageBodyPart = new MimeBodyPart();
        String text = "Summary\n-------\n\n" + summary + "\n\nDescription\n-----------\n\n" + description;
        messageBodyPart.setText( text );
        messageBodyPart.setDataHandler( new DataHandler( new ByteArrayDataSource( text,
                                                                                  "text/plain; charset=UTF8;" ) ) );
        multipart.addBodyPart( messageBodyPart );

        // Add ical
        messageBodyPart = new MimeBodyPart();
        String filename = "ical-" + type + "-" + taskId + ".ics";
        messageBodyPart.setFileName( filename );
        messageBodyPart.setHeader( "Content-Class",
                                   "urn:content-classes:calendarmessage" );
        messageBodyPart.setHeader( "Content-ID",
                                   "calendar_message" );
        String icalStr = getIcal( summary,
                                  description,
                                  startDate,
                                  priority,
                                  userInfo.getDisplayName( creator ),
                                  creatorEmail,
                                  type );

        messageBodyPart.setDataHandler( new DataHandler( new ByteArrayDataSource( icalStr,
                                                                                  "text/calendar; charset=UTF8; " ) ) );
        multipart.addBodyPart( messageBodyPart );

        message.setContent( multipart );
        message.saveChanges();

        Transport.send( message );
View Full Code Here

Examples of javax.mail.Multipart

        sbuf.append(tail);
      }

      part.setContent(sbuf.toString(), getEmailContentType());

      Multipart mp = new MimeMultipart();
      mp.addBodyPart(part);
      msg.setContent(mp);
     
      msg.setSentDate(new Date());
     
      Transport.send(msg);
View Full Code Here

Examples of javax.mail.Multipart

        // get body part
        Object content = mesage[i].getContent();

        if (content instanceof Multipart)
        {
          Multipart multipart = (Multipart)content;

          for (int j = 0, n = multipart.getCount(); j < n; j++)
          {
            Part part = (Part)multipart.getBodyPart(j);
            String contentType = part.getContentType();
            String disposition = part.getDisposition();

            if (disposition == null)
            {
View Full Code Here

Examples of javax.mail.Multipart

      Object o = message.getContent();
      if (o instanceof String)
      {
        msgBody.append((String) o);
      }else if(o instanceof Multipart){
        Multipart mp = (Multipart)o;
        int countMultipart = mp.getCount();

        for (int j = 0; j < countMultipart; j++)
        {
          // Part are numbered starting at 0
          BodyPart b = mp.getBodyPart(j);
          String mimeType2 = b.getContentType();
          String disposition2 = b.getDisposition();

          Object o2 = b.getContent();

          if (o2 instanceof String)
          {
            if (mimeType2 != null &&
                (mimeType2.toLowerCase().indexOf("text/plain") != -1 || mimeType2.toLowerCase().indexOf("text/html") != -1) &&
                (disposition2 == null ||(disposition2!=null && !disposition2.equals(Part.ATTACHMENT))))
            {
              if (mimeType2.toLowerCase().indexOf("text/html")>=0)
              {
                // HTML message body
                msgBody.append(b.getContent().toString());
              }else{
                // plain text part
                msgBody.append(b.getContent().toString());
              }
              if (! msgBody.toString().equals(""))
              {
                break;
              }
            }
          }else if(o2 instanceof Multipart){
            //"**This BodyPart is a nested Multipart.  ");
            Multipart mp2 = (Multipart)o2;
            int countMultipart1 = mp2.getCount();

            for (int k = 0; k < countMultipart1; k++)
            {
              // Part are numbered starting at 0
              BodyPart b2 = mp2.getBodyPart(k);
              String mimeType3 = b2.getContentType();
              String disposition3 = b2.getDisposition();

              Object o3 = b2.getContent();

View Full Code Here

Examples of javax.mail.Multipart

      message.setFrom(new InternetAddress(from));
      message.setSubject(subject);
      BodyPart messageBodyPart        = new MimeBodyPart();
      String messageContext = "text/plain";
      messageBodyPart.setContent(body, messageContext);
      Multipart multipart             = new MimeMultipart();
      multipart.addBodyPart(messageBodyPart);
      messageBodyPart = new MimeBodyPart();
      message.setContent(multipart);
      Transport.send(message);
    }catch(Exception e){
      System.out.println("[Exception]: SendMailEJB.sendMailMessage:");
View Full Code Here

Examples of javax.mail.Multipart

      } //end of if statement ((body.indexOf("&lt;") > -1) && (body.indexOf("&gt;") > -1))
*/

      messageBodyPart.setContent(body, messageContext);

      Multipart multipart             = new MimeMultipart();
      multipart.addBodyPart(messageBodyPart);

      messageBodyPart = new MimeBodyPart();
      HashMap attchmentids            = mailmessage.getAttachFileIDs();

      if ((attchmentids != null) && (attchmentids.size() != 0))
      {

        Set col       = attchmentids.keySet();
        Iterator itt  = col.iterator();
        int i         = 0;
        while (itt.hasNext())
        {
          String fileid        = (String) itt.next();
          String name          = (String) attchmentids.get(fileid);
          cvdl.setSql("email.savedraftattchment");
          cvdl.setInt(1, messageid);
          cvdl.setString(2, name);
          cvdl.setInt(3, Integer.parseInt(fileid));
          cvdl.executeUpdate();
          cvdl.clearParameters();
          i++;

          CvFileFacade cvfile  = new CvFileFacade();
          CvFileVO cvfilevo    = cvfile.getEmailAttachment(userId, Integer.parseInt(fileid), this.dataSource);

          String path          = cvfilevo.getPhysicalFolderVO().getFullPath(null, true) + cvfilevo.getName();

          DataSource source    = new FileDataSource(path);
          messageBodyPart.setDataHandler(new DataHandler(source));
          messageBodyPart.setFileName(name);
          multipart.addBodyPart(messageBodyPart);

        } //end of while loop(itt.hasNext())
      } //end of if statement ((attchmentids != null) && (attchmentids.size() != 0))
      // delete mail from  drafts
      if (mailmessage.getMessageID() != 0)
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.